๐ŸŒฑ Infra/Container_Docker

[Docker-Basic (7)] Container Image Registry ๊ตฌ์„ฑ

mini_world 2020. 9. 28. 17:17
๋ชฉ์ฐจ ์ ‘๊ธฐ

 

 

์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” 2๊ฐœ์˜ ํ˜ธ์ŠคํŠธ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
ํ•˜๋‚˜๋Š” Master Node๋กœ Registry ์„œ๋ฒ„ ์—ญํ• ์„ ํ•  ๋…ธ๋“œํžˆ๊ณ , ํ•˜๋‚˜๋Š” Worker Node๋กœ Registry์— ์ด๋ฏธ์ง€๋ฅผ Pull/Push ํ•  ๋…ธ๋“œ์ž…๋‹ˆ๋‹ค

์ €๋Š” AWS EC2๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ตฌ์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค :)

 


 

1. Docker Registry ์„ค์ •ํ•˜๊ธฐ 

1-1) Master Node ํ™•์ธ

๋‘๊ฐœ์˜ ํ˜ธ์ŠคํŠธ ์ค‘ ๋จผ์ € Mager ๋…ธ๋“œ์˜ ์„ค์ •์„ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค :)
๋จผ์ €, Hostname์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. (ํ˜ธ์ŠคํŠธ ์ด๋ฆ„ ๋ณ€๊ฒฝ์€ #hostnamectl set-hostname <๋ณ€๊ฒฝํ•  ์ด๋ฆ„> ๋ช…๋ น์–ด๋กœ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค)

[root@docker-master /]# hostnamectl
   Static hostname: docker-master.test.dom
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 3d5c05376530a2eb49e3e90576f83c5b
           Boot ID: 6e41fcc8e6b84010806c700415ff349c
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1062.12.1.el7.x86_64
      Architecture: x86-64

ํ˜ธ์ŠคํŠธ์˜ IP๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

[root@docker-master /]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP group default qlen 1000
    link/ether 02:86:58:3f:58:7c brd ff:ff:ff:ff:ff:ff
    inet 172.31.6.114/20 brd 172.31.15.255 scope global dynamic ens5
       valid_lft 2884sec preferred_lft 2884sec
    inet6 fe80::86:58ff:fe3f:587c/64 scope link
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:23:65:ae:a6 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

ํ˜ธ์ŠคํŠธ ์ด๋ฆ„๊ณผ IP๋ฅผ ์ •์˜ํ•œ ํŒŒ์ผ /etc/hosts ์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค!

[root@docker-master /]# vi /etc/hosts

[root@docker-master /]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

172.31.6.114 docker-master.test.dom
127.31.3.201 docker-worker.test.dom

ping์œผ๋กœ ํ˜ธ์ŠคํŠธ๊ฐ„์˜ ํ†ต์‹ ์„ ํ…Œ์ŠคํŠธ ํ•ฉ๋‹ˆ๋‹ค.

[root@docker-master centos]# ping -c3 docker-worker.test.dom

PING docker-worker.test.dom (127.31.3.201) 56(84) bytes of data.
64 bytes from docker-worker.test.dom (127.31.3.201): icmp_seq=1 ttl=64 time=0.028 ms
64 bytes from docker-worker.test.dom (127.31.3.201): icmp_seq=2 ttl=64 time=0.040 ms
64 bytes from docker-worker.test.dom (127.31.3.201): icmp_seq=3 ttl=64 time=0.038 ms

--- docker-worker.test.dom ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.028/0.035/0.040/0.007 ms

 

1-2) Worker Node ํ™•์ธ

๋‘๊ฐœ์˜ ํ˜ธ์ŠคํŠธ ์ค‘ ๋‘๋ฒˆ์งธ, Worker ๋…ธ๋“œ์˜ ์„ค์ •์„ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค :)
๋จผ์ €, Hostname์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. (ํ˜ธ์ŠคํŠธ ์ด๋ฆ„ ๋ณ€๊ฒฝ์€ #hostnamectl set-hostname <๋ณ€๊ฒฝํ•  ์ด๋ฆ„> ๋ช…๋ น์–ด๋กœ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค)

[root@docker-worker /]# hostnamectl
   Static hostname: docker-worker.test.dom
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 3d5c05376530a2eb49e3e90576f83c5b
           Boot ID: 1a791934c0e447128740450f9e9f731e
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1062.12.1.el7.x86_64
      Architecture: x86-64

ํ˜ธ์ŠคํŠธ์˜ IP๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

[root@docker-worker /]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP group default qlen 1000
    link/ether 02:c2:72:d9:ee:7c brd ff:ff:ff:ff:ff:ff
    inet 172.31.3.201/20 brd 172.31.15.255 scope global dynamic ens5
       valid_lft 2471sec preferred_lft 2471sec
    inet6 fe80::c2:72ff:fed9:ee7c/64 scope link
       valid_lft forever preferred_lft forever
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 02:42:6e:fa:50:8e brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:6eff:fefa:508e/64 scope link
       valid_lft forever preferred_lft forever

ํ˜ธ์ŠคํŠธ ์ด๋ฆ„๊ณผ IP๋ฅผ ์ •์˜ํ•œ ํŒŒ์ผ /etc/hosts ์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค!

[root@docker-worker /]# vi /etc/hosts

[root@docker-worker /]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

172.31.6.114 docker-master.test.dom
127.31.3.201 docker-worker.test.dom

ping์œผ๋กœ ํ˜ธ์ŠคํŠธ๊ฐ„์˜ ํ†ต์‹ ์„ ํ…Œ์ŠคํŠธ ํ•ฉ๋‹ˆ๋‹ค.

[root@docker-worker /]# ping -c3 docker-master.test.dom

PING docker-master.test.dom (172.31.6.114) 56(84) bytes of data.
64 bytes from docker-master.test.dom (172.31.6.114): icmp_seq=1 ttl=64 time=0.170 ms
64 bytes from docker-master.test.dom (172.31.6.114): icmp_seq=2 ttl=64 time=0.133 ms
64 bytes from docker-master.test.dom (172.31.6.114): icmp_seq=3 ttl=64 time=0.134 ms

--- docker-master.test.dom ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.133/0.145/0.170/0.022 ms

 

1-3) Master Node  PrivateRegistry ๊ตฌ์„ฑํ•˜๊ธฐ

์ด๋ฒˆ์—๋Š” Master ํ˜ธ์ŠคํŠธ์—์„œ Private Registry๋ฅผ ๊ตฌ์„ฑํ•ด๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.
registry๋ผ๋Š” ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•ด๋ด…์‹œ๋‹ค! :)

[root@docker-master /]# docker run -d -p 5000:5000 -v /var/lib/registry:/var/lib/registry --restart=always --name registry registry:2
Unable to find image 'registry:2' locally
2: Pulling from library/registry
cbdbe7a5bc2a: Pull complete
47112e65547d: Pull complete
46bcb632e506: Pull complete
c1cc712bcecd: Pull complete
3db6272dcbfa: Pull complete
Digest: sha256:8be26f81ffea54106bae012c6f349df70f4d5e7e2ec01b143c46e2c03b9e551d
Status: Downloaded newer image for registry:2
d941526862ea2e603743a83b0a80228a64ed5797af75446c5af3598b2e554b38

์ปจํ…Œ์ด๋„ˆ ๋ชฉ๋ก์„ ํ™•์ธํ•ด๋ณด๋‹ˆ, Registry์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์ž˜ ์šด์˜์ค‘์ด๋„ค์š”.

[root@docker-master /]# docker container ls -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
d941526862ea        registry:2          "/entrypoint.sh /etc…"   8 seconds ago       Up 7 seconds        0.0.0.0:5000->5000/tcp   registry

 

1-4) Worker Node Private Regisrty ์‚ฌ์šฉํ•˜๊ธฐ

๋„์ปค ๋ฐ๋ชฌ์„ ์กฐ๊ธˆ ์ˆ˜์ •ํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค. :)

๊ธฐ๋ณธ์ ์œผ๋กœ docker ๋ช…๋ น์–ด๋กœ ์ด๋ฏธ์ง€๋ฅผ Pull ํ• ๋•Œ๋Š” ๋ชจ๋‘ https ํ†ต์‹ ์ž…๋‹ˆ๋‹ค.
๊ทธ๋Ÿฐ๋ฐ, ์ €ํฌ๊ฐ€ ์•ž์—์„œ ๋งŒ๋“  Master ํ˜ธ์ŠคํŠธ์˜ Registry๋Š” SSL ์„ค์ •์ด ์•ˆ๋˜์–ด์žˆ์–ด์„œ.. httpํ†ต์‹ ๋งŒ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

๋งŒ์•ฝ ์•„๋ž˜์˜ ์„ค์ •์„ ํ•˜์ง€ ์•Š๊ณ , Master ํ˜ธ์ŠคํŠธ์— ์„ค์ •๋œ Private Repository๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๊ณ  ํ•œ๋‹ค๋ฉด, ์˜ค๋ฅ˜๋ฅผ ๋งŒ๋‚˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค :)
์ฆ‰, http ํ†ต์‹ ์ด ๊ฐ€๋Šฅํ•˜๋„๋ก ์•„๋ž˜ insecure ์„ค์ •์„ ํ•ด์ค˜์•ผํ•ฉ๋‹ˆ๋‹ค.

์ž, /etc/docker/daemon.json ์„ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค!

[root@docker-worker /]# cat /etc/docker/daemon.json

{
    "insecure-registries": ["docker-master.test.dom:5000"]
}

์ž ๋ฐ๋ชฌ ์„ค์ •์ด ๋ฐ˜์˜ ๋  ์ˆ˜์žˆ๋„๋ก docker ๋ฐ๋ชฌ์„ ์žฌ์‹œ์ž‘ ํ•ฉ๋‹ˆ๋‹ค.

[root@docker-worker /]# systemctl restart docker

๋ฐ๋ชฌ์— ์ด์ƒ์ด ์—†๋Š”์ง€, Status๋ฅผ ํ™•์ธํ•ด๋ด…์‹œ๋‹ค :)

[root@docker-worker /]# systemctl status docker
โ— docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since ํ™” 2020-09-29 00:56:51 UTC; 3s ago
     Docs: https://docs.docker.com
 Main PID: 11589 (dockerd)
    Tasks: 10
   Memory: 43.4M
   CGroup: /system.slice/docker.service
           โ””โ”€11589 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

 9์›” 29 00:56:51 docker-worker.test.dom dockerd[11589]: time="2020-09-29T00:56:51.690900672Z" level=info msg="ccR...grpc
 9์›” 29 00:56:51 docker-worker.test.dom dockerd[11589]: time="2020-09-29T00:56:51.690917992Z" level=info msg="Cli...grpc
 9์›” 29 00:56:51 docker-worker.test.dom dockerd[11589]: time="2020-09-29T00:56:51.699194401Z" level=info msg="[gr...ay2"
 9์›” 29 00:56:51 docker-worker.test.dom dockerd[11589]: time="2020-09-29T00:56:51.704697067Z" level=info msg="Loa...rt."
 9์›” 29 00:56:51 docker-worker.test.dom dockerd[11589]: time="2020-09-29T00:56:51.828753543Z" level=info msg="Def...ess"
 9์›” 29 00:56:51 docker-worker.test.dom dockerd[11589]: time="2020-09-29T00:56:51.865544811Z" level=info msg="Loa...ne."
 9์›” 29 00:56:51 docker-worker.test.dom dockerd[11589]: time="2020-09-29T00:56:51.882722824Z" level=info msg="Doc...3.13
 9์›” 29 00:56:51 docker-worker.test.dom dockerd[11589]: time="2020-09-29T00:56:51.882802675Z" level=info msg="Dae...ion"
 9์›” 29 00:56:51 docker-worker.test.dom systemd[1]: Started Docker Application Container Engine.
 9์›” 29 00:56:51 docker-worker.test.dom dockerd[11589]: time="2020-09-29T00:56:51.901919765Z" level=info msg="API...ock"
Hint: Some lines were ellipsized, use -l to show in full.

์ด์ œ httpd ์ด๋ฏธ์ง€๋ฅผ pull (์ด๋ฏธ์ง€ ๋‹ค์šด๋กœ๋“œ) ํ•˜๊ณ , ํƒœ๊ทธ๋ฅผ ๋‹ฌ์•„์„œ master ๋…ธ๋“œ์— ์žˆ๋Š” Private Registry์— ์ด๋ฏธ์ง€๋ฅผ Push ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

[root@docker-worker /]# docker pull httpd:latest
latest: Pulling from library/httpd
d121f8d1c412: Already exists
9cd35c2006cf: Pull complete
b6b9dec6e0f8: Pull complete
fc3f9b55fcc2: Pull complete
802357647f64: Pull complete
Digest: sha256:5ce7c20e45b407607f30b8f8ba435671c2ff80440d12645527be670eb8ce1961
Status: Downloaded newer image for httpd:latest
docker.io/library/httpd:latest

์ด๋ฏธ์ง€๋ฅผ ํ™•์ธํ•ด๋ด…์‹œ๋‹ค.

[root@docker-worker /]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
httpd               latest              417af7dc28bc        13 days ago         138MB

httpd ์ด๋ฏธ์ง€์˜ ํƒœ๊ทธ๋ฅผ ๋ณ€๊ฒฝํ•ด๋ด…์‹œ๋‹ค. 

docker tag <์˜ต์…˜> <์ด๋ฏธ์ง€ ์ด๋ฆ„>:<ํƒœ๊ทธ> <์ €์žฅ์†Œ ์ฃผ์†Œ, ์‚ฌ์šฉ์ž๋ช…>/<์ด๋ฏธ์ง€ ์ด๋ฆ„>:<ํƒœ๊ทธ>

๋ ˆํฌ์ง€ํ† ๋ฆฌ๊ฐ€ docker-master.test.dom:5000/httpd๋กœ ๋ฐ”๋€Œ์—ˆ๋„ค์š”!

[root@docker-worker /]# docker tag httpd docker-master.test.dom:5000/httpd
[root@docker-worker /]# docker images
REPOSITORY                          TAG                 IMAGE ID            CREATED             SIZE
httpd                               latest              417af7dc28bc        13 days ago         138MB
docker-master.test.dom:5000/httpd   latest              417af7dc28bc        13 days ago         138MB

Push ๋ช…๋ น์–ด๋กœ ์ด ์ด๋ฏธ์ง€๋ฅผ Master Private Registry๋กœ ํ‘ธ์‰ฌ ํ•ฉ๋‹ˆ๋‹ค.

[root@docker-worker /]# docker push docker-master.test.dom:5000/httpd
The push refers to repository [docker-master.test.dom:5000/httpd]
9f3f3dd7b0c2: Pushed
51eabf53c0c9: Pushed
6ce7826117a0: Pushed
d37da03a9458: Pushed
07cab4339852: Pushed
latest: digest: sha256:ee876fb8588d58d25eb95840c5d81d211f0ebf238c7c10cbaea10861f6a027db size: 1366

Registry ํ…Œ์ŠคํŠธ ์ „์—, ์ด๋ฏธ์ง€๋ฅผ ๋ชจ๋‘ ๊นจ๋—ํ•˜๊ฒŒ ์ง€์›Œ์ค์‹œ๋‹ค.
ํ—ท๊ฐˆ๋ฆฌ์ง€ ์•Š๊ฒŒ์š” :)

[root@docker-worker /]# docker rmi -f $(docker images -q)
Untagged: docker-master.test.dom:5000/httpd:latest
Untagged: docker-master.test.dom:5000/httpd@sha256:ee876fb8588d58d25eb95840c5d81d211f0ebf238c7c10cbaea10861f6a027db
Untagged: httpd:latest
Untagged: httpd@sha256:5ce7c20e45b407607f30b8f8ba435671c2ff80440d12645527be670eb8ce1961
Deleted: sha256:417af7dc28bc66aa2cc4af18cbfa934cc55f46721b101beac68b9f5c33d7fcb2
Deleted: sha256:2929da9174351249481441a39d499183fa7bb416fbfc2dfc36cdcfca001ace81
Deleted: sha256:46fba7aa125a55a717a218e2750c991bbf4d9e7bb66c56bacde76338a5b38f16
Deleted: sha256:a8151056fecd4987dd3fcde6579e8d34b72c1e39dfd5ac63209cffa0b0befb08
Deleted: sha256:97635989e45ed57deef09cd09be52d008a073f2e1e045a1ba91956fbc2db2961

์ด๋ฏธ์ง€๊ฐ€ ์ „๋ถ€ ์ž˜ ์ง€์›Œ์กŒ๋„ค์š”.

[root@docker-worker /]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

์ž, ์ด๋ฒˆ์—๋Š” docker Pull ๋ช…๋ น์–ด๋กœ httpd ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์‹œ ๋‹ค์šด๋กœ๋“œ ํ•ฉ์‹œ๋‹ค!
์•„๊นŒ ์ฒ˜์Œ๊ณผ ๋‹ค๋ฅธ์ ์€ httpd ์ด๋ฏธ์ง€ ์•ž์— ํŠน์ • ๋ ˆํฌ์ง€ํ† ๋ฆฌ์—์„œ ๊ฐ€์ ธ์˜ค๋„๋ก ์ง€์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

[root@docker-worker /]# docker pull docker-master.test.dom:5000/httpd
Using default tag: latest
latest: Pulling from httpd
d121f8d1c412: Already exists
9cd35c2006cf: Pull complete
b6b9dec6e0f8: Pull complete
fc3f9b55fcc2: Pull complete
802357647f64: Pull complete
Digest: sha256:ee876fb8588d58d25eb95840c5d81d211f0ebf238c7c10cbaea10861f6a027db
Status: Downloaded newer image for docker-master.test.dom:5000/httpd:latest
docker-master.test.dom:5000/httpd:latest

๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค.

[root@docker-worker /]# docker images
REPOSITORY                          TAG                 IMAGE ID            CREATED             SIZE
docker-master.test.dom:5000/httpd   latest              417af7dc28bc        13 days ago         138MB

 

1-5) Master Node ์‹ค ์ €์žฅ ๊ฒฝ๋กœ ํ™•์ธ & ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์ปจํ…Œ์ด๋„ˆ ์‚ญ์ œ

Master ๋…ธ๋“œ ์–ด๋””์— ์ด๋ฏธ์ง€๋“ค์ด ์ €์žฅ๋˜๋Š”์ง€ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค.

[root@docker-master /]# ls -al /var/lib/registry/docker/registry/v2/repositories/httpd/_layers/sha256/
ํ•ฉ๊ณ„ 4
drwxr-xr-x. 8 root root 4096  9์›” 29 01:08 .
drwxr-xr-x. 3 root root   20  9์›” 29 01:08 ..
drwxr-xr-x. 2 root root   18  9์›” 29 01:08 417af7dc28bc66aa2cc4af18cbfa934cc55f46721b101beac68b9f5c33d7fcb2
drwxr-xr-x. 2 root root   18  9์›” 29 01:08 802357647f642714e7ed35c6c28be6f1e8e3591764bc588f752cec6e13fb304b
drwxr-xr-x. 2 root root   18  9์›” 29 01:08 9cd35c2006cf02c3040a3d4b7feed7e0c53d77a8318a97d632929194b0352e67
drwxr-xr-x. 2 root root   18  9์›” 29 01:08 b6b9dec6e0f83ec34ba156463e1156deef38009e6f19b663864805527339bd0f
drwxr-xr-x. 2 root root   18  9์›” 29 01:08 d121f8d1c4128ebc1e95e5bfad90a0189b84eadbbb2fbaad20cbb26d20b2c8a2
drwxr-xr-x. 2 root root   18  9์›” 29 01:08 fc3f9b55fcc21c05be1d8ef3a6cf5a15967138bd8e4511195b8d36b80f9f0f5eโ€‹

์ด์ œ Registry ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.

[root@docker-master /]# docker rm -f $(docker ps -aq)
b4e345ad93cf

 

 

 

2. Docker Registry SSL ์ธ์ฆ์„œ ์ ์šฉํ•˜๊ธฐ

 

2-1) Master Node - ์ธ์ฆ์„œ ์ƒ์„ฑํ•˜๊ธฐ

์ด๋ฒˆ์—๋Š” SSL ์ธ์ฆ์ด ๊ฐ€๋Šฅํ•œ Private Registry๋ฅผ ๋งŒ๋“ค๊ฒ ์Šต๋‹ˆ๋‹ค.

๋จผ์ € ์ธ์ฆ์„œ ์ƒ์„ฑ์„ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์ธ์ฆ์„œ ์ƒ์„ฑ์„ ์œ„ํ•ด /etc/pki/tls/certs ๊ฒฝ๋กœ๋กœ ์ด๋™ํ•˜์—ฌ ํŒŒ์ผ ๋ชฉ๋ก์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

[root@docker-master /]# cd /etc/pki/tls/certs/

[root@docker-master certs]# ls -al
ํ•ฉ๊ณ„ 12
drwxr-xr-x. 2 root root  117  2์›” 29  2020 .
drwxr-xr-x. 5 root root   81  2์›” 29  2020 ..
-rw-r--r--. 1 root root 2516  8์›”  9  2019 Makefile
lrwxrwxrwx. 1 root root   49  2์›” 29  2020 ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
lrwxrwxrwx. 1 root root   55  2์›” 29  2020 ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
-rwxr-xr-x. 1 root root  610  8์›”  9  2019 make-dummy-cert
-rwxr-xr-x. 1 root root  829  8์›”  9  2019 renew-dummy-cert

์ด์ œ RSA ํ‚ค ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜๊ณ , ์ƒ์„ฑ๋œ ํŒŒ์ผ์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. (master.key)

[root@docker-master certs]# openssl genrsa -out master.key 2048

Generating RSA private key, 2048 bit long modulus
............................................................................................................................................+++
.+++
e is 65537 (0x10001)

[root@docker-master certs]# ls -al
ํ•ฉ๊ณ„ 16
drwxr-xr-x. 2 root root  135  9์›” 29 01:14 .
drwxr-xr-x. 5 root root   81  2์›” 29  2020 ..
-rw-r--r--. 1 root root 2516  8์›”  9  2019 Makefile
lrwxrwxrwx. 1 root root   49  2์›” 29  2020 ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
lrwxrwxrwx. 1 root root   55  2์›” 29  2020 ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
-rwxr-xr-x. 1 root root  610  8์›”  9  2019 make-dummy-cert
-rw-r--r--. 1 root root 1675  9์›” 29 01:14 master.key
-rwxr-xr-x. 1 root root  829  8์›”  9  2019 renew-dummy-cert

 

์ด๋ฒˆ์—๋Š” CSR ์ธ์ฆ์„œ๋ฅผ ์ƒ์„ฑ์„ฑํ•˜๊ณ , ๋ชฉ๋ก์„ ํ™•์ธํ•ด๋ด…์‹œ๋‹ค. (master.csr)

[root@docker-master certs]# openssl req -new -key master.key -out master.csr

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:KR
State or Province Name (full name) []:seoul
Locality Name (eg, city) [Default City]:seoul
Organization Name (eg, company) [Default Company Ltd]:test
Organizational Unit Name (eg, section) []:test
Common Name (eg, your name or your server's hostname) []:docker-master.test.dom
Email Address []:test@email.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

[root@docker-master certs]# ls -al
ํ•ฉ๊ณ„ 20
drwxr-xr-x. 2 root root  153  9์›” 29 01:17 .
drwxr-xr-x. 5 root root   81  2์›” 29  2020 ..
-rw-r--r--. 1 root root 2516  8์›”  9  2019 Makefile
lrwxrwxrwx. 1 root root   49  2์›” 29  2020 ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
lrwxrwxrwx. 1 root root   55  2์›” 29  2020 ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
-rwxr-xr-x. 1 root root  610  8์›”  9  2019 make-dummy-cert
-rw-r--r--. 1 root root 1054  9์›” 29 01:17 master.csr
-rw-r--r--. 1 root root 1675  9์›” 29 01:14 master.key
-rwxr-xr-x. 1 root root  829  8์›”  9  2019 renew-dummy-cert

์ด์ œ, ์ง„์งœ ์ธ์ฆ์„œ๋ฅผ ๋งŒ๋“ค์–ด์ค๋‹ˆ๋‹ค. 
master.crt๊ฐ€ ์ƒ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!

[root@docker-master certs]# openssl x509 -req -days 90 -in master.csr -signkey master.key -out master.crt
Signature ok
subject=/C=KR/ST=seoul/L=seoul/O=test/OU=test/CN=docker-master.test.dom/emailAddress=test@email.com
Getting Private key

[root@docker-master certs]# ls -al
ํ•ฉ๊ณ„ 24
drwxr-xr-x. 2 root root  171  9์›” 29 01:19 .
drwxr-xr-x. 5 root root   81  2์›” 29  2020 ..
-rw-r--r--. 1 root root 2516  8์›”  9  2019 Makefile
lrwxrwxrwx. 1 root root   49  2์›” 29  2020 ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
lrwxrwxrwx. 1 root root   55  2์›” 29  2020 ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
-rwxr-xr-x. 1 root root  610  8์›”  9  2019 make-dummy-cert
-rw-r--r--. 1 root root 1302  9์›” 29 01:19 master.crt
-rw-r--r--. 1 root root 1054  9์›” 29 01:17 master.csr
-rw-r--r--. 1 root root 1675  9์›” 29 01:14 master.key
-rwxr-xr-x. 1 root root  829  8์›”  9  2019 renew-dummy-cert

 

์ธ์ฆ์„œ ํŒŒ์ผ์„ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋„๋ก docker ๊ฒฝ๋กœ์— ๋ณต์‚ฌํ•˜๊ณ  docker ๋ฐ๋ชฌ์„ ์žฌ์‹œ์ž‘ ํ•ฉ๋‹ˆ๋‹ค.

[root@docker-master certs]# mkdir /etc/docker/certs.d
[root@docker-master certs]# cp master.* /etc/docker/certs.d/
[root@docker-master certs]# cp master.crt /etc/pki/ca-trust/source/anchors/
[root@docker-master certs]# update-ca-trust
[root@docker-master certs]# systemctl restart docker

 

2-2) Master Node - SSL ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์ƒ์„ฑํ•˜๊ธฐ

์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

[root@docker-master /]# docker run -d -p 5000:5000 \
--restart=always --name registry\
-v /var/lib/registry:/var/lib/registry\
-v /etc/docker/certs.d:/certs\
-e REGISRTY_HTTP_TLS_CERTIFICATE=/certs/master.crt\
-e REGISTRY_HTTP_TLS_KEY=/certs/master.key registry:2

39facd6dabadcdfafae07efde3a620f1b0a4995a1668b68ef91c5de1839f4e3a

์ปจํ…Œ์ด๋„ˆ ๋ชฉ๋ก์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. Registry ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์ž˜ ์šด์˜๋˜๊ณ  ์žˆ๋„ค์š” :)

[root@docker-master /]# docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
39facd6dabad        registry:2          "/entrypoint.sh /etc…"   11 seconds ago      Up 10 seconds       0.0.0.0:5000->5000/tcp   registry

 

2-3) Worker Node - ํ…Œ์ŠคํŠธ ํ•˜๊ธฐ

์ž, Worker Node์—์„œ ํ…Œ์ŠคํŠธ ํ•ด๋ด…์‹œ๋‹ค!.
Master Node์— ์ƒ์„ฑํ•œ SSL Private Registry๋ฅผ ์‚ฌ์šฉํ•ด๋ด…์‹œ๋‹ค!

๋จผ์ €, ์ด๋ฏธ์ง€์— ํƒœ๊ทธ๋ฅผ ๋‹ฌ์•„์ค„๊ฑด๋ฐ, ํ˜•์‹์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

docker tag <์˜ต์…˜> <์ด๋ฏธ์ง€ ์ด๋ฆ„>:<ํƒœ๊ทธ> <์ €์žฅ์†Œ ์ฃผ์†Œ, ์‚ฌ์šฉ์ž๋ช…>/<์ด๋ฏธ์ง€ ์ด๋ฆ„>:<ํƒœ๊ทธ>

๋„์ปค ํƒœ๊ทธ๋ฅผ ์ƒˆ๋กœ ๋‹ฌ์•„์ค์‹œ๋‹ค :)

[root@docker-worker /]# docker tag docker-master.test.dom:5000/httpd:latest docker-master.test.dom:5000/httpd:sslversion

๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ํ™•์ธํ•ด๋ณด๋ฉด, ์œ„์—์„œ ์„ค์ •ํ•œ๊ฒƒ์ฒ˜๋Ÿผ ํƒœ๊ทธ๊ฐ€ ๋ณ€๊ฒฝ๋œ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

[root@docker-worker /]# docker images
REPOSITORY                          TAG                 IMAGE ID            CREATED             SIZE
docker-master.test.dom:5000/httpd   latest              417af7dc28bc        13 days ago         138MB
docker-master.test.dom:5000/httpd   sslversion          417af7dc28bc        13 days ago         138MB

์ด์ œ ์ด๋ฏธ์ง€๋ฅผ Push ํ•ฉ๋‹ˆ๋‹ค!

[root@docker-worker /]# docker push docker-master.test.dom:5000/httpd:sslversion
The push refers to repository [docker-master.test.dom:5000/httpd]
9f3f3dd7b0c2: Pushed
51eabf53c0c9: Pushed
6ce7826117a0: Pushed
d37da03a9458: Pushed
07cab4339852: Pushed
sslversion: digest: sha256:ee876fb8588d58d25eb95840c5d81d211f0ebf238c7c10cbaea10861f6a027db size: 1366

Master ๋…ธ๋“œ์— ๊ตฌ์„ฑํ•ด๋†“์€ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์— ์ด๋ฏธ์ง€๋ฅผ Pushํ–ˆ์œผ๋‹ˆ, ์ด์ œ ๋‹ค์‹œ Pull ํ•ด๋ณผ ์ฐจ๋ก€์ž…๋‹ˆ๋‹ค.๊ทธ์ „์— worker ๋…ธ๋“œ์— ์ด๋ฏธ์ง€๋ฅผ ํ™•์ธํ•˜๊ณ  ์ „์ฒด ์‚ญ์ œ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
docker images ๋ช…๋ น์–ด๋กœ ํ™•์ธํ–ˆ์„๋•Œ ์•„๋ฌด๊ฒƒ๋„ ์•ˆ๋‚˜์˜ค๋ฉด ๋ฉ๋‹ˆ๋‹ค!!

[root@docker-worker /]# docker images
REPOSITORY                          TAG                 IMAGE ID            CREATED             SIZE
docker-master.test.dom:5000/httpd   latest              417af7dc28bc        13 days ago         138MB
docker-master.test.dom:5000/httpd   sslversion          417af7dc28bc        13 days ago         138MB

[root@docker-worker /]# docker rmi -f $(docker images -q)
Untagged: docker-master.test.dom:5000/httpd:latest
Untagged: docker-master.test.dom:5000/httpd:sslversion
Untagged: docker-master.test.dom:5000/httpd@sha256:ee876fb8588d58d25eb95840c5d81d211f0ebf238c7c10cbaea10861f6a027db
Deleted: sha256:417af7dc28bc66aa2cc4af18cbfa934cc55f46721b101beac68b9f5c33d7fcb2
Deleted: sha256:2929da9174351249481441a39d499183fa7bb416fbfc2dfc36cdcfca001ace81
Deleted: sha256:46fba7aa125a55a717a218e2750c991bbf4d9e7bb66c56bacde76338a5b38f16
Deleted: sha256:a8151056fecd4987dd3fcde6579e8d34b72c1e39dfd5ac63209cffa0b0befb08
Deleted: sha256:97635989e45ed57deef09cd09be52d008a073f2e1e045a1ba91956fbc2db2961

[root@docker-worker /]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

๋„์ปค ์ด๋ฏธ์ง€๋ฅผ Pull ํ•ด์„œ ์ด๋ฏธ์ง€๋ฅผ ์ž˜ ๋ฐ›์•„์˜ค๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค :)
์•„์ฃผ ์ž˜ ๋ฐ›์•„์˜ค๋„ค์š”!!

[root@docker-worker /]# docker pull docker-master.test.dom:5000/httpd:sslversion
sslversion: Pulling from httpd
d121f8d1c412: Already exists
9cd35c2006cf: Pull complete
b6b9dec6e0f8: Pull complete
fc3f9b55fcc2: Pull complete
802357647f64: Pull complete
Digest: sha256:ee876fb8588d58d25eb95840c5d81d211f0ebf238c7c10cbaea10861f6a027db
Status: Downloaded newer image for docker-master.test.dom:5000/httpd:sslversion
docker-master.test.dom:5000/httpd:sslversion

[root@docker-worker /]# docker images
REPOSITORY                          TAG                 IMAGE ID            CREATED             SIZE
docker-master.test.dom:5000/httpd   sslversion          417af7dc28bc        13 days ago         138MB

 

2-4) Master Node - ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์ปจํ…Œ์ด๋„ˆ ์‚ญ์ œํ•˜๊ธฐ

์ž ์ด์ œ ํ…Œ์ŠคํŠธ๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์œผ๋‹ˆ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค :)
Master ๋…ธ๋“œ์—์„œ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‚ญ์ œํ•ด์ฃผ์„ธ์š”.

[root@docker-master /]# docker rm -f $(docker ps -aq)
39facd6dabad

 

 

 

3. Docker Registry SSH ์ธ์ฆ์„œ + ์‚ฌ์šฉ์ž ์ธ์ฆ ์ ์šฉํ•˜๊ธฐ

 

์ง€๊ธˆ๊นŒ์ง€ Master ๋…ธ๋“œ์— ๋„์ปค ์ด๋ฏธ์ง€ ์ €์žฅ์†Œ๋ฅผ ๋งŒ๋“ค๊ณ  ์‚ฌ์šฉํ•ด๋ดค๊ณ , HTTPS๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก SSL์ธ์ฆ์„œ๋ฅผ ์ ์šฉํ•ด๋ดค์Šต๋‹ˆ๋‹ค.
๋งˆ์ง€๋ง‰์œผ๋กœ, ์‚ฌ์šฉ์ž ์ธ์ฆ๋„ ํ•จ๊ป˜ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ฉ๋‹ˆ๋‹ค :) 

3-1) Master Node - ์‚ฌ์šฉ์ž ์ธ์ฆ ์„ค์ •ํ•˜๊ธฐ

์‚ฌ์šฉ์ž ์ธ์ฆ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” httpd ์—์„œ ์ œ๊ณตํ•˜๋Š” httpd-tools ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค :)
๋จผ์ € ์‚ฌ์šฉ์ž ์ธ์ฆ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

[root@docker-master /]# yum install httpd-tools

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: d36uatko69830t.cloudfront.net
 * extras: d36uatko69830t.cloudfront.net
 * updates: d36uatko69830t.cloudfront.net
base                                                                                                                  | 3.6 kB  00:00:00
docker-ce-stable                                                                                                      | 3.5 kB  00:00:00
extras                                                                                                                | 2.9 kB  00:00:00
updates                                                                                                               | 2.9 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-93.el7.centos will be installed
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-tools-2.4.6-93.el7.centos.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-tools-2.4.6-93.el7.centos.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-5.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                           Arch                         Version                                     Repository                  Size
=============================================================================================================================================
Installing:
 httpd-tools                       x86_64                       2.4.6-93.el7.centos                         base                        92 k
Installing for dependencies:
 apr                               x86_64                       1.4.8-5.el7                                 base                       103 k
 apr-util                          x86_64                       1.5.2-6.el7                                 base                        92 k

Transaction Summary
=============================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 288 k
Installed size: 584 k
Is this ok [y/d/N]: y
Downloading packages:
(1/3): apr-1.4.8-5.el7.x86_64.rpm                                                                                     | 103 kB  00:00:00
(2/3): apr-util-1.5.2-6.el7.x86_64.rpm                                                                                |  92 kB  00:00:00
(3/3): httpd-tools-2.4.6-93.el7.centos.x86_64.rpm                                                                     |  92 kB  00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                        3.1 MB/s | 288 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-5.el7.x86_64                                                                                                    1/3
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                                               2/3
  Installing : httpd-tools-2.4.6-93.el7.centos.x86_64                                                                                    3/3
  Verifying  : apr-1.4.8-5.el7.x86_64                                                                                                    1/3
  Verifying  : httpd-tools-2.4.6-93.el7.centos.x86_64                                                                                    2/3
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                                               3/3

Installed:
  httpd-tools.x86_64 0:2.4.6-93.el7.centos

Dependency Installed:
  apr.x86_64 0:1.4.8-5.el7                                           apr-util.x86_64 0:1.5.2-6.el7

Complete!

htpasswd ๋ช…๋ น์–ด๋กœ ์‚ฌ์šฉ์ž๋ฅผ ์ถ”๊ฐ€ํ•ด์ค๋‹ˆ๋‹ค.
์กฐ๊ธˆ์ด๋”ฐ๊ฐ€ ์ด ์‚ฌ์šฉ์ž๋กœ ๋กœ๊ทธ์ธ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•  ์˜ˆ์ •์ด๋‹ˆ, ๊ณ„์ •๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๊นŒ๋จน์ง€ ์•Š๊ฒŒ ์ฃผ์˜ํ•˜์„ธ์š”.

[root@docker-master /]# htpasswd -Bc /etc/docker/.htpasswd admin
New password:
Re-type new password:
Adding password for user admin

 

3-2) Master Node - SSL + ์ธ์ฆ ๊ธฐ๋Šฅ์ด ์ ์šฉ๋œ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์ƒ์„ฑ

SSL ๋ฐ ์‚ฌ์šฉ์ž์ธ์ฆ ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋œ Registry ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

[root@docker-master /]# docker run -d -p 5000:5000 --restart=always --name registry \
-v /var/lib/registry:/var/lib/registry \
-v /etc/docker/certs.d:/certs \
-v /etc/docker:/auth \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/master.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/master.key \
-e REGISTRY_AUTH=htpasswd \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/.htpasswd \
-e REGISTRY_AUTH_HTPASSWD_REALM="Registry Realm" registry:2

์ •์ƒ๋™์ž‘ํ•˜๋Š”์ง€๋„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค :)
์ž˜ ๋™์ž‘ํ•˜๋„ค์š”! ์ด์ œ ๋‹ค์Œ ๋‹จ๊ณ„๋กœ ๋„˜์–ด๊ฐ€์„œ ํ…Œ์ŠคํŠธ ํ•ด๋ด…์‹œ๋‹ค.

[root@docker-master /]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                    NAMES
2bf8c98f110d        registry:2          "/entrypoint.sh /etc…"   About a minute ago   Up About a minute   0.0.0.0:5000->5000/tcp   registry

 

3-3) Worker Node - ํ…Œ์ŠคํŠธ ํ•˜๊ธฐ!

๋จผ์ € docker login <๋ ˆ์ง€์ŠคํŠธ๋ฆฌ> ๋ช…๋ น์–ด๋กœ ๋กœ๊ทธ์ธ ํ•ฉ๋‹ˆ๋‹ค.
๋งŒ์•ฝ ๋กœ๊ทธ์ธํ•˜์ง€ ์•Š๊ณ  ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๊ณ  ํ•˜๋ฉด ์—๋Ÿฌ๊ฐ€ ๋‚˜์˜ต๋‹ˆ๋‹ค :) ์ •์ƒ์ด์—์š”.
์œ„์—์„œ ๋งŒ๋“ค์—ˆ๋˜ admin ์‚ฌ์šฉ์ž๋กœ ๋กœ๊ทธ์ธ ํ•ฉ๋‹ˆ๋‹ค.

[root@docker-worker /]# docker login docker-master.test.dom:5000
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

ํ…Œ์ŠคํŠธ ์ „์— Worker ๋…ธ๋“œ์— ์žˆ๋Š” ์ด๋ฏธ์ง€๋ฅผ ๋‹ค ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.

[root@docker-worker /]# docker rmi -f $(docker images -q)
Untagged: docker-master.test.dom:5000/httpd:sslversion
Untagged: docker-master.test.dom:5000/httpd@sha256:ee876fb8588d58d25eb95840c5d81d211f0ebf238c7c10cbaea10861f6a027db
Deleted: sha256:417af7dc28bc66aa2cc4af18cbfa934cc55f46721b101beac68b9f5c33d7fcb2
Deleted: sha256:2929da9174351249481441a39d499183fa7bb416fbfc2dfc36cdcfca001ace81
Deleted: sha256:46fba7aa125a55a717a218e2750c991bbf4d9e7bb66c56bacde76338a5b38f16
Deleted: sha256:a8151056fecd4987dd3fcde6579e8d34b72c1e39dfd5ac63209cffa0b0befb08
Deleted: sha256:97635989e45ed57deef09cd09be52d008a073f2e1e045a1ba91956fbc2db2961

SSL ๋ฐ ์‚ฌ์šฉ์ž ์ธ์ฆ ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋œ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ์ •์ƒ์ ์œผ๋กœ ์ปจํ…Œ์ด๋„ˆ ์ด๋ฏธ์ง€๊ฐ€ ๋‹ค์šด๋ฐ›์•„์ง€๋„ค์š” :)

[root@docker-worker /]# docker pull docker-master.test.dom:5000/httpd:sslversion
sslversion: Pulling from httpd
d121f8d1c412: Already exists
9cd35c2006cf: Pull complete
b6b9dec6e0f8: Pull complete
fc3f9b55fcc2: Pull complete
802357647f64: Pull complete
Digest: sha256:ee876fb8588d58d25eb95840c5d81d211f0ebf238c7c10cbaea10861f6a027db
Status: Downloaded newer image for docker-master.test.dom:5000/httpd:sslversion
docker-master.test.dom:5000/httpd:sslversion

 

์„ฑ๊ณต์ž…๋‹ˆ๋‹ค!

๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค๐Ÿ˜

728x90