发布自己的镜像
DockerHub
1、地址:https://hub.docker.com/ 注册自己的账户!
2、确保账号可以登录
3、在服务器上提交镜像
# 查看docker login 帮助命令
[root@liulihui /]# docker login --help
Usage: docker login [OPTIONS] [SERVER]
Options:
-p, --password string Password
--password-stdin Take the password from stdin
-u, --username string Username
我们可以给镜像添加 [tag] 标签;
[root@liulihui /]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
diytomcat latest 151a2aa6587a 2 days ago
# docker tag 镜像id 镜像命名:1.0
[root@liulihui /]# docker tag 151a2aa6587a liulihui/tomcat:1.0
4、登录成功后就可以提交镜像了,就一步 docker push 镜像[tag]
[root@liulihui /]# docker push liulihui/tomcat:1.0
The push refers to repository [docker.io/liulihui/tomcat]
4dd680b89c8e: Preparing
f971b48f72ba: Preparing
78347477df70: Preparing
74ddd0ec08fa: Preparing
阿里云镜像服务
1、登录阿里云
2、找到容器镜像服务
3、创建命名空间
4、创建镜像仓库,选择本地仓库
5、浏览阿里云镜像仓库
6、镜像推送到阿里云镜像仓库
# 本地镜像 docker tag 镜像id 重新镜像命名:[tag]
docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/liuliuhui/public:[镜像版本号]
# docker push 镜像:[tag]
docker push registry.cn-hangzhou.aliyuncs.com/liuliuhui/public:[镜像版本号]
阿里云镜像 参考官方地址,就可以了