发布自己的镜像
发布到DockerHub
1、地址https://registry.hub.docker.com/ 注册账号
2、确定这个账号可以登录
zzw@zzw-virtual-machine:~/dockerfile$ docker login --help
Usage: 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
zzw@zzw-virtual-machine:~/dockerfile$ sudo docker login -u 160305163208
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
zzw@zzw-virtual-machine:~/dockerfile$
3、在我们服务器上提交自己的镜像
zzw@zzw-virtual-machine:~/dockerfile$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mycentos latest 7e03e7d74738 18 minutes ago 291MB
tomcat latest c0e850d7b9bb 4 days ago 667MB
mysql 8.0 0627ec6901db 7 days ago 556MB
nginx latest 62d49f9bab67 13 days ago 133MB
portainer/portainer latest 580c0e4e98b0 5 weeks ago 79.1MB
centos latest 300e315adb2f 4 months ago 209MB
#先tag 换成 用户名/自取镜像名字
zzw@zzw-virtual-machine:~/dockerfile$ sudo docker tag 7e03e7d74738 160305163208/mycentos:1.0
zzw@zzw-virtual-machine:~/dockerfile$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mycentos latest 7e03e7d74738 19 minutes ago 291MB
160305163208/mycentos 1.0 7e03e7d74738 19 minutes ago 291MB
tomcat latest c0e850d7b9bb 4 days ago 667MB
mysql 8.0 0627ec6901db 7 days ago 556MB
nginx latest 62d49f9bab67 13 days ago 133MB
portainer/portainer latest 580c0e4e98b0 5 weeks ago 79.1MB
centos latest 300e315adb2f 4 months ago 209MB
#push上传
zzw@zzw-virtual-machine:~/dockerfile$ sudo docker push 160305163208/mycentos:1.0
发布到阿里云镜像服务上