配置docker镜像仓库
vi /etc/docker/daemon.json
提加镜像私服仓库地址
{
"registry-mirrors": [
"https://registry.docker-cn.com"
],
"insecure-registries": [
"120.79.10.212"
],
"exec-opts": ["native.cgroupdriver=systemd"]
}
重启docker 使配置生效
systemctl daemon-reload
systemctl restart docker
查看是否配置成功
docker info
Insecure Registries:
120.79.10.212
127.0.0.0/8
Registry Mirrors:
登陆镜像仓库
docker login 120.79.10.212
登陆成功
[root@xxm harbor]# docker login 120.79.10.212
Authenticating with existing credentials...
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
在没有配置镜像私服 使用docker login
登陆会提示
新建项目组
新建项目
点进相应的项目组 在推送镜像 有相应的docker tag
和docker push
的提示密令
测试镜像仓库
## 拉取nginx镜像
docker pull nginx:latst
## 查看镜像
docker images
## 给镜像打tag 标签
docker tag nginx:latest 120.79.10.212/xxm/nginx:latest
## 推送镜像
docker push 120.79.10.212/xxm/nginx:latest
The push refers to repository [120.79.10.212/xxm/nginx]
fe6a7a3b3f27: Pushed
d0673244f7d4: Pushing [==============> ] 16.48MB/56.65MB
d0673244f7d4: Pushed
d8a33133e477: Pushed
查看镜像
验证镜像仓库 删除本地镜像再重新拉取
docker rmi nginx
docker pull 120.79.10.212/xxm/nginx