在 VyOS 中,容器镜像是静态的,restart 无法更新版本。你需要先拉取新镜像,再销毁旧容器,最后重建新容器。
手动更新三部曲
假设你的容器名字叫 sing-box:
第一步:拉取最新镜像
add container image ghcr.io/sagernet/sing-box:latest输出示例
Trying to pull ghcr.io/sagernet/sing-box:latest...
Getting image source signatures
Copying blob sha256:c98ab41ce5332feb7bbc7e1b9b0ad1120766164b7d86d7b6df0be64548ab2734
Copying blob sha256:1074353eec0db2c1d81d5af2671e56e00cf5738486f5762609ea33d606f88612
Copying blob sha256:43501643e3590123840dde8267797d35436de0d9ed619e8090b7340b02b3a227
Copying config sha256:0e00446867f94c3dc1a76be4b518ca68dc1cd1dbb1505cab23c24b104b776c7e
Writing manifest to image destination
0e00446867f94c3dc1a76be4b518ca68dc1cd1dbb1505cab23c24b104b776c7e执行完后,输入 show container image 确认出现了新的 Image ID。
show container image
REPOSITORY TAG IMAGE ID CREATED SIZE
ghcr.io/sagernet/sing-box latest 0e00446867f9 34 minutes ago 58.8 MB
<none> <none> a15113fcda85 5 days ago 58.8 MB
新镜像会取代原来镜像的TAG。
第二步:切换镜像(在配置模式下)
configure
# 停止并禁用当前容器
set container name sing-box disable
commit
# 重新启用(此时 VyOS 会自动关联到你刚才下载的最新的 :latest 镜像 ID)
delete container name sing-box disable
commit
save
exit第三步:清理旧镜像(释放空间)
# 查看镜像列表,找到那个名为 <none> 或者旧 ID 的镜像
show container image
# 删除旧镜像
delete container image <IMAGE_ID>可以进入容器shell查看是否更新成功,搭建了面板的也可以在面板中查看。
connect container sing-box
/ # sing-box version
sing-box version 1.12.16
Environment: go1.25.5 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale
Revision: ab18010ee1f6ff716fa8cf14e857b4593eeaba66
CGO: disabled
发表回复