发布到DockerHub
DockerHub网址:https://hub.docker.com/
首先确保已经注册了账号,并登录成功;才能把自己的镜像发布到DockerHub上!
一、命令行代码登录
root@liang:/home/joila# docker login -h
Flag shorthand -h has been deprecated, please use --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 # 用户名
二、Push提交镜像
将本地的镜像上传到镜像仓库,前提是要先登陆到镜像仓库!!!
docker push [OPTIONS] NAME[:TAG]
可以看到,提交的时候,也是按照镜像的层级来进行提交的!
三、查看是否提交成功
到DockerHub查看上传情况
发布到阿里云
一、登录阿里云
操作网址:https://cr.console.aliyun.com/
二、找到容器镜像服务
三、创建命名空间
四、创建容器镜像
五、浏览镜像库信息
六、命令行代码登录
sudo docker login --username=1144828910@qq.com registry.cn-hangzhou.aliyuncs.com
七、Push提交镜像
sudo docker push registry.cn-hangzhou.aliyuncs.com/joila/learning:[镜像版本号]
同步镜像
查看是否同步成功
八、查看是否提交成功
到镜像搜索板块,搜索前面我们提交的镜像