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

Construction of docker Private Warehouse

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

The development and operation of Docker container applications are inseparable from reliable image management. Although Docker officially provides a public image repository, it is necessary to deploy Registry in a private environment in terms of security and efficiency.

1. Environment

.. 92, docker private warehouse server, centos7.3

.. 91, server using docker image, centos7.3

2. Install the software

Install docker (both servers will be installed):

Yum install-y epel-release

Yum install-y docker-io

Start:

Systemctl start docker

Systemctl enable docker

Docker version

Systemctl status docker

Install a private warehouse (. 92):

Docker pull registry# pulls registry image

Docker run-- name docker-registry-d-p 5000 registry registry# launches a registry container that provides private warehouse services.

Execute the command curl-X GET http://127.0.0.1:5000/v2/_catalog, and the response is as follows: it is a json object, where the value of repositories is an empty json array, indicating that there is no image in the repository:

{"repositories": []}

The private warehouse was created successfully.

3. Configuration

Support http protocol push (... 91):

Normally, the application server pushes the image to the repository using https. Here, we use ordinary http to test the push through the command line, so we need to modify the startup parameters of docker to allow it to work with http protocol.

Modify the / etc/default/docker file:

Cat / etc/default/docker

DOCKER_OPTS= "--insecure-registry.. 92: 5000"

Modify / usr/lib/systemd/system/docker.service

Add two lines

[Service]

Type=notify

EnvironmentFile=-/etc/default/docker

ExecReload=/usr/bin/dockerd-H fd:// $DOCKER_OPTS

Modify / etc/docker/daemon.json

{

"insecure-registries": ["https://...92:5000"]"

}

Add a TAG with ip of private repository to the image to be pushed:

Docker tag 8428e0398d0d... 92:5000/myip_father

Push the image to the private warehouse:

Docker push... 92:5000/myip_father

Check:

Execute on the server:

Curl-X GET http://127.0.0.1:5000/v2/_catalog

Appears: {"repositories": ["myip_father"]}

Curl-X GET https://*.*.*.92:5000/v2/_catalog

Appears: {"repositories": ["myip_father"]}

Successfully pushed to a private warehouse.

Pull from the private warehouse:

Docker pull.. * .92: 5000/myip_father

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