root@ruopu:~# docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: test Password: WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded # 登录docker root@ruopu:~# docker tag ubuntu:14.04 test/ubuntu:14.04 # 准备要推送的镜像,一定要写为自己docker的username root@ruopu:~# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE test/ubuntu 14.04 f17b6a61de28 2 days ago 188MB # 查看在本地有了要推送的镜像 root@ruopu:~# docker push test/ubuntu:14.04 The push refers to repository [docker.io/test/ubuntu] 85a0d9a0e38e: Mounted from library/ubuntu fe72fc94fa1a: Mounted from library/ubuntu ea213108ab36: Mounted from library/ubuntu 960c7c5516b2: Mounted from library/ubuntu 14.04: digest: sha256:296c2904734ac0f13f3ab7265eeafb2efc33f085eeb87c875d28c360cec18700 size: 1152 # 推送镜像 ruopu@ruopu:~$ docker search test NAME DESCRIPTION STARS OFFICIAL AUTOMATED # 查询自己上传的镜像,没有结果。可能是因为上传的速度较慢,所以暂时看不到,并且再次上传时提示文件已存在。但登录docker hub后,发现镜像已经上传了。