克隆docker图像到dockerhub帐户

让我们说一个正式的docker基础图像ubuntu:latest ,我有一个dockerhub帐户myaccount 。 如何克隆ubuntu:latestmyaccount的存储库? 工作stream程然后可以被引入如下,

 $ docker pull myaccount/ubuntu:latest $ docker run -it myaccount/ubuntu:latest /bin/bash # root@mycontainer: apt-get install onepackage # root@mycontainer: exit $ docker commit mycontainer myaccount/ubuntu:latest-new $ docker push myaccount/ubuntu:latest-new 

我需要push三angular洲latest-newlatest

使用docker tag ubuntu:latest myaccount/ubuntu:latest 。 (您还应该使用特定的版本号进行标记,以便您在更新时仍可以引用图像:最新)

然后docker push myaccount/ubuntu

它实际上不会生成副本,但会将新标签添加到现有图像。 其他人不会看到标签,除非他们docker pull myaccount/ubuntu

Macos使用该命令

 $ docker pull NAME:tag $ docker tag NAME:tag myaccount/name:tag $ docker login # yourname # password $ docker push myaccount/name:tag