DockerHub
https://hub.docker.com/ 注册账号
1、登录docker
[root@--- ~]# docker login --helpUsage: docker login [OPTIONS] [SERVER]Log in to a Docker registry.If no server is specified, the default is defined by the daemon.Options:-p, --password string Password--password-stdin Take the password from stdin-u, --username string Username[root@--- ~]#[root@--- ~]# docker login -u xiaobluewhalePassword:WARNING! Your password will be stored unencrypted in /root/.docker/config.json.Configure a credential helper to remove this warning. Seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded[root@--- ~]#
2、服务器上提交镜像
docker push [OPTIONS] NAME[:TAG]
docker push命令推送镜像的规范是:注册用户名/镜像名。
使用以下方法之一命名您的本地镜像:当你构建它们时,使用 docker build -t <hub-user>/<repo-name>[:<tag>]重命名现有的本地镜像 docker tag <existing-image> <hub-user>/<repo-name>[:<tag>]通过docker commit <existing-container> <hub-user>/<repo-name>[:<tag>] 用于提交更改docker push <hub-user>/<repo-name>:<tag>
docker push xiao/tomcatUsing default tag: latestThe push refers to repository [docker.io/xiao/tomcat]69421fc728fb: Preparing1f6217f0c2bb: Preparingaa9c3f9fafec: Preparing7d4a4cd414a9: Preparing74ddd0ec08fa: Preparingdenied: requested access to the resource is denied # 拒绝#推送失败的原因: name必须是注册用户名#解决push失败问题#增加一个tag, 重命名镜像docker tag 24b3a476f143 xiaobluewhale/tomcat:1.0The push refers to repository [docker.io/xiaobluewhale/tomcat]docker imagesREPOSITORY TAG IMAGE ID CREATED SIZExiaobluewhale/tomcat 1.0 24b3a476f143 13 hours ago 680MBxiao/tomcat 1.0 24b3a476f143 13 hours ago 680MBxiao/tomcat latest 24b3a476f143 13 hours ago 680MB#推送镜像docker push xiaobluewhale/tomcat:1.0

提交的时候也是按照镜像的层级提交的
在个人DockerHub上查看推送成功的镜像
