Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy docker Private Warehouse on Linux system

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to deploy docker private repositories on Linux. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

Modify configuration http access

[root@test01 ~]# cat /etc/docker/daemon.json{"registry-mirrors": ["https://registry.docker-cn.com"],"insecure-registries":["192.168.1.30:5000"]}

If not configured this way, the result is as follows. This problem may be caused by the client using https, docker registry does not use https service. One way to do this is to change the client's request for the address "192.168.1.30:5000" to http

[root@test01 ~]# docker push 192.168.1.30:5000/centosThe push refers to a repository [192.168.1.30:5000/centos]Get https://192.168.1.30:5000/v1/_ping: http: server gave HTTP response to HTTPS client

Running docker-registry with containers

[root@test01 ~]# docker run -d -p 5000:5000 --privileged=true -v /opt/data/registry:/tmp/registry --name='docker-registry' registry

Parameter Description:

-v /opt/data/registry:/tmp/registry : By default, the repository will be stored in the container under the/tmp/registry directory, and the specified local directory will be mounted to the container-privileged=true: The security module selinux in CentOS7 disables permissions, and the parameters add privileges to the container. If no upload image is added, a permission error will be reported (OSEror: [Errno 13] Permission denied: '/tmp/registry/repositories/libriary') or (Received unexpected HTTP status: 500 Internal Server Error).

uploading the image

[root@test01 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdocker.io/wordpress latest 346b1443b020 30 hours ago 407 MB[root@test01 ~]# docker push 192.168.1.30:5000/wordpressThe push refers to a repository [192.168.1.30:5000/wordpress]An image does not exist locally with the tag: 192.168.1.30:5000/wordpress[root@test01 ~]#

According to the prompt, we know that we need to modify the tag to upload

[root@test01 ~]# docker tag docker.io/wordpress 192.168.1.30:5000/wordpress[root@test01 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE192.168.1.30:5000/wordpress latest 346b1443b020 30 hours ago 407 MBdocker.io/wordpress latest 346b1443b020 30 hours ago 407 MB[root@test01 ~]# docker push 192.168.1.30:5000/wordpressThe push refers to a repository [192.168.1.30:5000/wordpress]3d7c1bb6ce9f: Pushed

Download from private repository

[root@test01 ~]# docker pull 192.168.1.30:5000/wordpress

Client persistent configuration uses private repository

Add ADD_REGISTRY='--add-registry 192.168.1.30:5000'[root@test01 ~]# cat /etc/sysconfig/docker# /etc/sysconfig/docker# Modify these options if you want to change the way the docker daemon runsOPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false -H unix:///var/run/docker.sock -H 0.0.0.0:2376'ADD_REGISTRY='--add-registry 192.168.1.30:5000'if [ -z "${DOCKER_CERT_PATH}" ]; then DOCKER_CERT_PATH=/etc/dockerfi Thank you for reading! About "how to deploy docker private repository on Linux system" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report