docker push image 到docker hub

docker push image 到docker hub

1
https://blog.csdn.net/fake_hydra/article/details/84865117

1-1. 你需要有一个docker hub的账号
如果没有,注册一个:https://hub.docker.com

123

1-2. 创建好以后,到终端,登陆到自己的账户
输入自己的用户名密码即可

1
2
3
docker login
ancky2006
输入密码

123

1-3. 查看信息:

1
docker info|grep Username

123

1-4. 解决 WARNING: bridge-nf-call-iptables is disabled

执行docker info出现如下警告

1
2
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

解决办法:

1
vi /etc/sysctl.conf

添加以下内容

1
2
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1

最后再执行

1
sysctl -p

123
123
123

2. 查看已有镜像

1
docker images

123

3. 上传镜像

1
docker push ansible/centos7-ansible:latest

123

3-2. 解决上传过程中报错 unauthorized: authentication required

123
123

3-3. 创建之后你就看到了这条命令,把本地的images名称改成这个一样( docker tag ${imageId} ${username}/${repo} ),你就可以执行它完成push操作了

123

1
docker tag ansible/centos7-ansible:latest ancky2006/images:centos7-3-latest      //给image打上标签

123

然后执行

1
2
docker push ancky2006/images:centos7-3-latest            //docker push ancky2006/images:tagname
docker pull ancky2006/images:centos7-3-latest            //这个是下载命令

123

4. 查看hub官网

123
123
123

5.同样道理,把别的两个也传上去.

1
2
docker tag centos7.3:86x64-mini ancky2006/images:centos7.3-86x64-mini
docker tag centos7.3:86x64-desk-vnc-ssh ancky2006/images:centos7.3-86x64-desk-vnc-ssh
1
2
docker push ancky2006/images:centos7.3-86x64-mini                    
docker push ancky2006/images:centos7.3-86x64-desk-vnc-ssh

123
123
123

6. 从仓库拉镜像

1
2
3
docker pull ancky2006/images:centos7-3-latest
docker pull ancky2006/images:centos7.3-86x64-mini                    
docker pull ancky2006/images:centos7.3-86x64-desk-vnc-ssh
备注:
每个用户只能建一个 私有仓库(Private),但可以建多个公用仓库(Public).
所以这边尽量选择 Public

123

Leave a Reply

Your email address will not be published. Required fields are marked *