2

Unraid: 手动更新 Docker 应用

 2 years ago
source link: https://www.codewoody.com/posts/15794/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Published Jun 16, 2021

Unraid: 手动更新 Docker 应用

最近 Unraid 出现了一个问题。明明一个 Docker 应用已经有了新版本,但是在 Unraid 的 Docker 页面使用 “Check for updates” 按钮却无法找到新版本。在网上搜索这个问题,大部分是在讨论是 Unraid 在检查更新的时候会显示新版本 “Not avaiable”,我这里却是每个应用都是 “Up to date” 状态。鉴于网上找不到合适的方法解决这个问题,我们可以通过命令行来手动更新。

以频繁更新的 Gitlab 更新为例。首先查看现有镜像的版本:

$ docker images

REPOSITORY TAG IMAGE ID CREATED SIZE
gitlab/gitlab-ce latest 7d0eb3299e71 2 weeks ago 2.25GB

然后我们尝试拉取最新的版本:

$ docker pull gitlab/gitlab-ce

Using default tag: latest
latest: Pulling from gitlab/gitlab-ce
345e3491a907: Already exists
57671312ef6f: Already exists
5e9250ddb7d0: Already exists
7f815eeffff6: Pull complete
1a4fe87ef93e: Pull complete
eb13b56b9e19: Pull complete
2f19275b151e: Pull complete
84bbe8ae841a: Pull complete
0de204d1d029: Pull complete
Digest: sha256:dc40d3be9c6c60db0b02581e7caa824315748f0f746b507074f4a1934f9b3037
Status: Downloaded newer image for gitlab/gitlab-ce:latest
docker.io/gitlab/gitlab-ce:latest

拉取完成以后再次查看镜像版本:

$ docker images

REPOSITORY TAG IMAGE ID CREATED SIZE
gitlab/gitlab-ce latest 6d2361b39196 39 hours ago 2.25GB
gitlab/gitlab-ce <none> 7d0eb3299e71 2 weeks ago 2.25GB

通过 ID 可以判定之前版本的 Gitlab 镜像已经替换成的更新版本(TAG),这时我们回到 Unraid 的 Docker 配置页面,点击 Gitlab 应用图标,然后选择 Edit,在任何一个配置(例如端口)上在末尾添加一个空格再删掉空格,这时下方的 “Apply” 按钮会从灰色变成橙色,我们点击 Apply,Unraid 会认为配置发生变更,因此会删除原来的容器,并从 gitlab/gitlab-ce:latest 创建新的容器。这里 latest 标签对应的镜像已经是我们拉取的新镜像,待执行完毕,Gitlab 就完成了更新。我们可以通过 ID 将旧版本的镜像删除:

$ docker image rm 7d0eb3299e71

Untagged: gitlab/gitlab-ce@sha256:cf35a173a11eda176abb0759b1be5314e1e3391ce7fe088376f72135edd72b22
Deleted: sha256:7d0eb3299e7198b68ba3bf9cd8253c507aa0665a47cc05c43bb1f660377f3442
Deleted: sha256:c55d2f174b33a0524f96fa6c0659c9c763dc74b2a6a0affb79846f6bf269d43b
Deleted: sha256:d8b3672a87a4c694d250444770b628448ba22261fbc792cfe9a17746b8731cb5
Deleted: sha256:5e62181bcd418eb278cfc388eec9b4d873b0caeab0c7344fd51d32fd003e5cee
Deleted: sha256:57ca7b519b521310019f532e2e0794d5e545623545171f8f0b68455d69a96150
Deleted: sha256:3706f27d038b54d14d5b198c04815ba15cd42749860bef787041ee27b620d8d7
Deleted: sha256:58e9132fd51591a363a1e2e5edf2f677a610b1ae94c8d5c235362a776b47dab7

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK