docker 搭建私有仓库
搭建私有仓库
创建registry容器
1
docker run -d -p 5000:5000 -v /data/docker/image/:/var/lib/registry --restart=always registry:2
查看registry端口
1
2[root@registry ~]# netstat -nplt |grep 5000
tcp 0 0 :::5000 :::* LISTEN 20701/docker-proxy
配置docker 确保从私有仓库pull镜像时不会报错
1 | cat /etc/docker/daemon.json |
测试上传下载
1 | [root@k8n1 ~]# docker tag nginx:latest 172.16.1.9:5000/chulinx/nginx:latest |
docker 更改镜像、容器存储位置
关闭docker容器服务
1
systemctl stop docker
把更改之前的docker数据复制或者移动到要更改的目录下
1
mkdir /opt/docker/ && scp -r /var/lib/docker/* /opt/docker/
更改docker配置文件OPTIONS参数增加–graph=/opt/docker
1
2
3
4
5
6
7# /etc/sysconfig/docker
# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false --graph=/opt/docker'
if [ -z "${DOCKER_CERT_PATH}" ]; then
DOCKER_CERT_PATH=/etc/docker
fi启动docker服务
1
systemctl start docker
- 本文作者: ChuLinx
- 本文链接: http://yoursite.com/2019/01/22/docker进阶用法总结/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!