V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
pobing123
V2EX  ›  Docker

docker 从仓库更新 images 到本地,怎么才最优雅?

  •  
  •   pobing123 · Dec 23, 2020 · 2517 views
    This topic created in 1960 days ago, the information mentioned may be changed or developed.
    刚入门 docker,还是小白。
    比如从 hub.docker 更新 redis 的 latest 版本。
    docker pull redis
    更新完后,本地较早的版本的名字会变成<none>
    需要手动 docker rmi 删除
    这也太麻烦事了。
    有更好的办法吗?
    提前感谢
    8 replies    2020-12-25 11:25:52 +08:00
    boris93
        1
    boris93  
       Dec 23, 2020 via Android
    隔一段时间 grep 出来 none 标签的批量删除
    julyclyde
        2
    julyclyde  
       Dec 23, 2020
    cron 执行 docker prune
    hteen
        3
    hteen  
       Dec 23, 2020
    watchtower
    stille
        4
    stille  
       Dec 23, 2020 via iPhone
    watchtower 单次更新可以自动拉取新的,删除旧的并按照之前启动参数重启容器

    参考

    https://www.ioiox.com/archives/84.html
    monkeyWie
        5
    monkeyWie  
       Dec 23, 2020 via Android
    docker pure 定期执行
    Tink
        6
    Tink  
    PRO
       Dec 24, 2020 via Android
    定期 prune
    pobing123
        7
    pobing123  
    OP
       Dec 24, 2020
    感谢以上各位。
    原以为,docker 存在单条命令,可以原有镜像上附加更新层
    julyclyde
        8
    julyclyde  
       Dec 25, 2020
    @pobing123 可以附加。问题是这镜像的构建过程,新旧版本是分叉的,而不是叠加的关系
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   893 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 21:02 · PVG 05:02 · LAX 14:02 · JFK 17:02
    ♥ Do have faith in what you're doing.