Specific method to build docker private library


Ready
server1, server2 (where server1 as a private library server, server2 as an ordinary client)

(Related Recommendation: docker tutorial)

on server1
1, download Registry

1

Docker pull Registry: Latest

2, configure the / etc / default / docker because https needs The certificate password is more complicated, just add the insecure-registry directly

1

2

3

4

5

6

7

8

9

10

11

12

13

# 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"

3. Start registry

1

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

4, tag image

1

docker tag redis server1: 5000/redis

5, push save private image

1

docker push server1: 5000/redis

5.1, view push to private Warehouse mirroring

1

2

3

4

5

6

$ docker search 10.10.105.71:5000/tonybai/busybox/

Error response from daemon: Unexpected status code 404

But through the v2 version of the API, we can achieve the same purpose:

 

$curl http://10.10.105.71:5000/v2/_catalog

{"repositories":["tonybai/busybox"]}

on server2 (client)
because docker Registry mentioned that if the secure registry mode is adopted, then the Docker Daemon on all hosts that interact with the Registry must be configured: --insecure -registry option. In addition to this mode, you can also configure the certificate, which is not explained here.

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

1

2

3

4

5

6

7

8

9

10

11

12

13

# 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"

2、下载

1

docker pull server1:5000/redis

3、提交推送

1

2

3

docker tag redis server1:5000/redis

 

docker push server1:5000 / repeat

Guess you like

Origin blog.csdn.net/kexin178/article/details/112858019