一.发布自己的项目
DockerHub
- 地址:https://hub.docker.com/ 注册自己的账号
- 确定账号可以登录
- 登录完毕后就可以提交镜像,就是一步 docker push ```shell
[root@localhost mytomcat]# 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
登录
[root@localhost mytomcat]# docker login -u xiaohuyyds 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
4. 在我们的服务器上提交自己的镜像```shell# 登录完毕后就可以提交镜像,就是一步 docker push[root@localhost mytomcat]# docker push diytomcatUsing default tag: latestThe push refers to repository [docker.io/library/diytomcat]f725786d3850: Preparing111655768d68: Preparinge63e32bd0ac3: Preparingd0054e91bdb7: Preparing174f56854903: Preparingdenied: requested access to the resource is denied#报错--> 解决[root@localhost mytomcat]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdiytomcat latest 8a8f9324c996 6 hours ago 759MBdockerfilemy 1.0 854426a238fb 7 hours ago 591MBdockerfileos02 latest 4fa78330abf4 14 hours ago 231MBdockerfilecentos01 latest 10e546aab68a 14 hours ago 231MBxiaohuyyds/centos latest 5c1eb233c81b 32 hours ago 231MBtomcat01 001 bb022423c461 2 days ago 684MBmysql 5.7 8aa4b5ffb001 8 days ago 462MBtomcat 9.0 6705ea17274a 10 days ago 680MBtomcat latest 0183eb12bb0c 10 days ago 680MBnginx latest fa5269854a5e 2 weeks ago 142MBelasticsearch 8.1.3 b543e34fe3ca 2 weeks ago 1.2GBhello-world latest feb5d9fea6a5 7 months ago 13.3kBcentos 7 eeb6ee3f44bd 7 months ago 204MBcentos latest 5d0da3dc9764 7 months ago 231MBportainer/portainer latest 580c0e4e98b0 13 months ago 79.1MBelasticsearch 7.6.2 f29a1ee41030 2 years ago 791MB#解决:增加一个tag[root@localhost mytomcat]# docker tag diytomcat xiaohuyyds/tomcat:1.0[root@localhost mytomcat]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdiytomcat latest 8a8f9324c996 6 hours ago 759MBxiaohuyyds/tomcat 1.0 8a8f9324c996 6 hours ago 759MBdockerfilemy 1.0 854426a238fb 7 hours ago 591MBdockerfileos02 latest 4fa78330abf4 14 hours ago 231MBdockerfilecentos01 latest 10e546aab68a 14 hours ago 231MBxiaohuyyds/centos latest 5c1eb233c81b 32 hours ago 231MBtomcat01 001 bb022423c461 2 days ago 684MBmysql 5.7 8aa4b5ffb001 8 days ago 462MBtomcat 9.0 6705ea17274a 10 days ago 680MBtomcat latest 0183eb12bb0c 10 days ago 680MBnginx latest fa5269854a5e 2 weeks ago 142MBelasticsearch 8.1.3 b543e34fe3ca 2 weeks ago 1.2GBhello-world latest feb5d9fea6a5 7 months ago 13.3kBcentos 7 eeb6ee3f44bd 7 months ago 204MBcentos latest 5d0da3dc9764 7 months ago 231MBportainer/portainer latest 580c0e4e98b0 13 months ago 79.1MBelasticsearch 7.6.2 f29a1ee41030 2 years ago 791MB#docker push 上去即可 自己发布的镜像尽量带上自己的版本号[root@localhost mytomcat]# docker push xiaohuyyds/tomcat:1.0The push refers to repository [docker.io/xiaohuyyds/tomcat]f725786d3850: Pushing 537.6kB/221.1MB111655768d68: Preparinge63e32bd0ac3: Pushing 528.5kB/318.1MBd0054e91bdb7: Pushing 3.072kB174f56854903: Pushing 527.9kB/203.9MB^C
阿里云镜像服务器上
略:因为自己没有买阿里云服务器
