clone 이미지를 하나 생성해서 docker 설치
주소는 211.183.3.110 으로 하여 현재 구성된 사설 저장소에
간단한 my_httpd:1.0 이미지를 push 해보세요!
base image = httpd
root@ubuntu:~# curl -ssL <https://get.docker.com/> | bash
root@ubuntu:~# mkdir /docker
root@ubuntu:~# cd /docker
root@ubuntu:/docker# mkdir regi
root@ubuntu:/docker# cd regi
root@ubuntu:/docker/regi# vi Dockerfile
FROM httpd
root@ubuntu:/docker/regi# docker build --tag localhost:4000/my_httpd:1.0 .
root@ubuntu:/docker/regi# docker build --tag localhost:4000/my_httpd:1.0 .
Sending build context to Docker daemon 2.048kB
Step 1/1 : FROM httpd:latest
---> 157dcdf23d6c
Successfully built 157dcdf23d6c
Successfully tagged localhost:4000/my_httpd:1.0
root@ubuntu:/docker/regi# docker build --tag 211.183.3.100:5000/my_httpd .
root@ubuntu:/docker/regi# docker build --tag 211.183.3.100:5000/my_httpd .
Sending build context to Docker daemon 2.048kB
Step 1/1 : FROM httpd:latest
---> 157dcdf23d6c
Successfully built 157dcdf23d6c
Successfully tagged 211.183.3.100:5000/my_httpd:latest
root@ubuntu:/docker/regi# docker push 211.183.3.100:5000/my_httpd
root@ubuntu:/docker/regi# docker push 211.183.3.100:5000/my_httpd
Using default tag: latest
The push refers to repository [211.183.3.100:5000/my_httpd]
Get "[<https://211.183.3.100:5000/v2/>](<https://211.183.3.100:5000/v2/>)": http: server gave HTTP response to HTTPS client
이건 안 된 거다.
현재 저장소는 HTTPS연결만 허용되어 있어 HTTP 연결이 불가능하다. 따라서 insecure한 연결(HTTP 연결)을 허용해야 한다.
root@ubuntu:/docker/regi# vi /etc/docker/daemon.json
{
"insecure-registries": ["211.183.3.100:5000"]
}
정확히는 인증서 없이 연결하겠다는 뜻.
root@ubuntu:/docker/regi# systemctl restart docker
설정 바꿨으면 뭐다? 재시작이다 ㅇㅋ? 유남쌩?
root@ubuntu:/docker/regi# docker push 211.183.3.100:5000/my_httpd:latest
root@ubuntu:/docker/regi# docker push 211.183.3.100:5000/my_httpd:latest
The push refers to repository [211.183.3.100:5000/my_httpd]
df40ccf15557: Pushed
10d8cd84bc49: Pushed
8bb2d8abcb18: Pushed
2bccf7e3b941: Pushed
b5ebffba54d3: Pushed
latest: digest: sha256:664278a845343347da35cb7fef6e641c2ed56a8d85cfd836a7010e6072c0137f size: 1366
예아 베이베
여기까지 하면 대략 다음과 같은 구조다.
root@ubuntu:/docker# docker run -dp 7878:80 --name my_httpd localhost:5000/my_httpd
root@ubuntu:/docker# docker run -dp 7878:80 --name my_httpd localhost:5000/my_httpd
Unable to find image 'localhost:5000/my_httpd:latest' locally
latest: Pulling from my_httpd
025c56f98b67: Already exists
94efcc2978ca: Pull complete
f06194b937dc: Pull complete
e8f73658d652: Pull complete
0a22f1af035b: Pull complete
Digest: sha256:664278a845343347da35cb7fef6e641c2ed56a8d85cfd836a7010e6072c0137f
Status: Downloaded newer image for localhost:5000/my_httpd:latest
c5ac87ecb3f50cd184a5ea458609e366677d0328364be7616ccc1802eda8a94d
root@ubuntu:/docker# curl localhost:7878
root@ubuntu:/docker# curl localhost:7878
<html><body><h1>It works!</h1></body></html>
예아