Specific methods to build docker private library

王林
Release: 2020-12-11 17:09:12
forward
7094 people have browsed it

Specific methods to build docker private library

Preparation

server1, server2 (server1 serves as a private library server and server2 serves as a normal client)

(Related recommendations: docker Tutorial)

On server1

1. Download registry

docker pull registry:latest
Copy after login

2. Configure /etc/default/docker Because https requires a certificate password, etc. It is more complicated, so directly Just add insecure-registry

# Docker Upstart and SysVinit configuration file

# Customize location of Docker binary (especially for development testing).
#DOCKER="/usr/local/bin/docker"

# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
DOCKER_OPTS="--insecure-registry 127.0.0.1:5000"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"

# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"
Copy after login

3. Start registry

sudo docker run --name registry -d -p 5000:5000 -v /home/docker_registry:/var/lib/registry --restart=always registry:latest
Copy after login

4. Tag image

docker tag redis server1:5000/redis
Copy after login

5. Push and save the private image

docker push server1:5000/redis
Copy after login

5.1. View the image pushed to the private warehouse

$ docker search 10.10.105.71:5000/tonybai/busybox/
Error response from daemon: Unexpected status code 404
但通过v2版本的API,我们可以实现相同目的:

$curl  http://10.10.105.71:5000/v2/_catalog
{"repositories":["tonybai/busybox"]}
Copy after login

On server2 (client)

Because it is mentioned in docker Registry , If the insecure registry mode is adopted, the Docker Daemon on all hosts that interact with the Registry must be configured with: –insecure-registry option. In addition to this mode, certificates can also be configured, which will not be explained here

1. Configuration-insecure-registry(centos:/etc/sysconfig/docker ubuntu:/etc/default/docker)

# Docker Upstart and SysVinit configuration file

# Customize location of Docker binary (especially for development testing).
#DOCKER="/usr/local/bin/docker"

# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
DOCKER_OPTS="--insecure-registry server1:5000"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"

# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"
Copy after login

2. Download

docker pull server1:5000/redis
Copy after login

3. Submit push

docker tag redis server1:5000/redis

docker push server1:5000/redis
Copy after login

The above is the detailed content of Specific methods to build docker private library. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!