DockerHub
注册dockerhub https://hub.docker.com/signup,需要有一个账号
查看登录命令
[root@xiaoyequ /]# 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 p
登录
[root@xiaoyequ /]# docker login -u xiaoyequ666
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
将镜像发布出去
[root@xiaoyequ /]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
diytomcat latest cfae60a041a3 12 hours ago 686MB
entrypointtest latest 81aedb452f1c 3 days ago 237MB
cmdtest latest ad2fb09d1b81 3 days ago 237MB
mycentos 0.1 0deef898a52e 4 days ago 321MB
xiaoyequ/centos latest 905fe8ff663c 5 days ago 237MB
tomcat02 1.0 57d6e3382b24 5 days ago 649MB
redis latest 235592615444 9 days ago 104MB
tomcat latest 2eb5a120304e 9 days ago 647MB
mysql 5.7 9cfcce23593a 10 days ago 448MB
nginx latest 4392e5dad77d 2 weeks ago 132MB
portainer/portainer latest cd645f5a4769 2 weeks ago 79.1MB
elasticsearch 7.6.2 f29a1ee41030 2 months ago 791MB
centos latest 470671670cac 5 months ago 237MB
[root@xiaoyequ /]# docker push xiaoyequ666/diytomcat:1.0
The push refers to repository [docker.io/xiaoyequ666/diytomcat]
An image does not exist locally with the tag: xiaoyequ666/diytomcat
问题:本地镜像名无帐号信息,解决加 tag即可
docker tag cfae60a041a3 xiaoyequ666/tomcatofxiaoyequ:1.0
注意:斜杠前面的要和用户名一致(xiaoyequ666)
再次 push, ok
阿里云镜像服务
登录阿里云,找到容器镜像服务
https://cr.console.aliyun.com/
创建命名空间
创建镜像仓库
点击进入这个镜像仓库,可以看到所有的信息
测试推送发布
登录阿里云
sudo docker login --username=小叶曲666 registry.cn-zhangjiakou.aliyuncs.com
设置 tag
sudo docker tag [ImageId] registry.cn-zhangjiakou.aliyuncs.com/xiaoyequ/xiaoyequ:[镜像版本号]
[root@xiaoyequ /]# sudo docker tag 235592615444 registry.cn-zhangjiakou.aliyuncs.com/xiaoyequ/xiaoyequ:v1.0
推送命令
sudo docker push registry.cn-zhangjiakou.aliyuncs.com/xiaoyequ/xiaoyequ:[镜像版本号]