Home  >  Q&A  >  body text

Docker 怎么跳过本地安装官方的镜像?

我本地下载了一个 MySql 镜像,想安装官方的。
docker pull mysql 后它老自动把本地的给装上去了。

删除本地的mysql docker rmi -f mysql
docker images 查看确实没了,但是
再次 docker pull mysql,发现安装的还是之前的那个……

怎么跳过本地的 MySql ,安装官方的镜像啊? 谢谢

PHP中文网PHP中文网2756 days ago724

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-24 16:02:40

    Is there any container using this mysql image? Or did you re-mirror? docker tag过这个镜像?或者使用其它版本的mysql镜像?或者在使用基于 debian:jessie

    You must know that an image is not a single file, but a collection of storage layers. When you execute

    . docker rmi -f mysql 的时候,实际上是删除 mysql:latest 这个 tag,因此第一行一般是 Untagged: mysql:latest

    The next logic is that if there are no others

    , this is how many layers have been deleted, and the others have not been deleted. tag指向该存储层,则会真实删除该存储层,然后继续查询下一层的存储层是否还有人在使用,没有继续删除,直到某一层发现还有容器或者镜像依赖该存储层,那么就停止删除。所以当你执行 docker rmi 的时候,可以观察一下出现了多少个 Deleted: sha256: ...

    So if you redo

    the operation without actually deleting the storage layer. docker tag 了这个mysql镜像,那么当你执行 docker rmi 的时候,只会执行 untag

    Or maybe the system has other images based on the same basic image

    It also starts from this layer. debian:jessie 的,那么docker rmi 也只会删到这一层就停止了,以后每次 pull

    Similarly, this concept of hierarchical storage will also affect the check value of each layer of your

    , and then compare it locally to see which ones already exist. If they exist, do not repeat the pull and use the current storage layer directly. If it does not exist, pull the new one. docker pull。 当你执行docker pull的时候,会查看官方 docker:latest

    If you take the previous one and re-

    you can ensure the consistency between the image file and the official website. docker tag的例子,如果你之前重新tag过该 mysql:latest镜像,那么docker rmi实际上没有删除该镜像,而再次 docker pull mysql 的时候,发现所有存储层本地都有,那必然不需要再次 pull,直接将最顶层tagmysql:latest即可。这种情况无需担心,也不必强迫重新下载,因为sha256sum

    So your question needs to depend on the specific situation. Generally speaking, it is not recommended to use the

    tag in a production environment, but to clearly specify the version so that upgrades and maintenance are possible. latest

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-04-24 16:02:40

    docker pull docker.io/mysql

    reply
    0
  • Cancelreply