Connecting

불좀 꺼줄래? 내 Docker좀 보게 PART 4 - 실전 연습 - Docker hub 사용하기 본문

Container

불좀 꺼줄래? 내 Docker좀 보게 PART 4 - 실전 연습 - Docker hub 사용하기

팬도라 2020. 11. 13. 12:04
반응형

Docker Hub는 많은 개발자들이 Docker 이미지를 개발하여 공개하는 사이트라고 할 수 있다. git이 코드를 관리하기 위한 공간이라면 Docker Hub는 이미지를 관리하는 공간이라고 할 수 있다. 가입을 하지 않더라도 이미지를 다운로드하거나 사용하는데 지장이 없지만 회원가입을 통해서 자기가 만든 이미지를 공개할 수 있다. github와 같이 Public repositories는 무제한이지만 Private repositories를 사용하기 위해서는 무료 계정의 경우 1개, 그 이상을 사용하고 싶다면 별도의 가격을 지불해야 한다.

만약 기업 혹은 그룹에서 별도의 비용을 지불하지 않고 별도의 별도의 Private Docker Registry를 구축하고 싶다면 CNCF에서 인증한 HARBOR를 사용하는 것도 좋은 선택이다.

우리는 Public repositories에 있는 프로그램 중 몇 개를 사용하겠지만, 사실 이미 전 시간부터 docker 이미지를 사용하기 위해 docker pull 명령을 사용할 때, Docker Hub에 등록된 이미지를 사용해왔다. 추후 이미지를 만들고 업로드하는 과정을 실습하기 위해 다음 링크에 들어가서 계정을 생성하도록 하며, 그중 유명한 이미지 몇 가지를 다운로드하여 실행하도록 하겠다.

회원가입을 완료했다면 앞으로의 실습을 위해 로컬 컴퓨터에 Docker Hub계정을 로그인하도록 하겠다. 다음과 같은 명령을 실행한다.

$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: 
Password:
Login Succeeded

Docker Hub의 계정을 로그아웃 하고 싶다면 다음 명령을 입력하면 된다.

$ docker logout
Removing login credentials for https://index.docker.io/v1/

Nginx & httpd

대중적으로 많이 사용하는 웹서버이다.

$ docker run -p 8080:80 -d nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
d121f8d1c412: Pull complete
66a200539fd6: Pull complete
e9738820db15: Pull complete
d74ea5811e8a: Pull complete
ffdacbba6928: Pull complete
Digest: sha256:fc66cdef5ca33809823182c9c5d72ea86fd2cef7713cf3363e1a0b12a5d77500

$ docker run -p 8081:80 -d httpd 
Unable to find image 'httpd:latest' locally
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
045e411fd176677d3d50aea5f5c1361ad38dc55205895606b8be6d3d93b18bb5

odoo

CRM, 전자 상거래, 청구, 회계, 제조, 창고, 프로젝트 관리 및 재고 관리를 포함한 비즈니스 관리 소프트웨어 도구 모음이다.

$ docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres --name db postgres:10
Unable to find image 'postgres:10' locally
10: Pulling from library/postgres
abb454610128: Pull complete
cb9fcd810109: Pull complete
ec47b45aabd5: Pull complete
1e0ca8f035cc: Pull complete
2a84515c4921: Pull complete
82b05e9043e1: Pull complete
aeb401fb975d: Pull complete
3a459c6d6103: Pull complete
1a468736e354: Pull complete
2308e9bc3771: Pull complete
8dcf6283be4c: Pull complete
a5a7039be658: Pull complete
d4b6b67f010b: Pull complete
dbfabe56f372: Pull complete
Digest: sha256:c28b97689c3fc2ede878e9cced7607361764651da670ae7dfe6e1becd6603863
Status: Downloaded newer image for postgres:10
45b859e2e00ec6a96d3cf52e5c3142087e037dfbff8656a932ebeed1faa7101c

$ docker run -p 8069:8069 --name odoo --link db:db -t odoo
Unable to find image 'odoo:latest' locally
latest: Pulling from library/odoo
d121f8d1c412: Pull complete
918cd4aaeb69: Pull complete
f28fcced6356: Pull complete
955db1482846: Pull complete
017e349353bc: Pull complete
9d71f13db1c6: Pull complete
b6d377fe6745: Pull complete
d16781d5c37e: Pull complete
41b885b58a50: Pull complete
Digest: sha256:fccc13945d62704dde11bf91d232acd360c85d2e4268f6ee26d0b4eedf20ffea
Status: Downloaded newer image for odoo:latest
2020-10-09 05:59:57,135 1 INFO ? odoo: Odoo version 14.0-20201002
2020-10-09 05:59:57,135 1 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf
2020-10-09 05:59:57,135 1 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/var/lib/odoo/addons/14.0', '/mnt/extra-addons']
2020-10-09 05:59:57,135 1 INFO ? odoo: database: odoo@172.17.0.2:5432
2020-10-09 05:59:57,248 1 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
2020-10-09 05:59:57,328 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on fc3ae8b49f24:8069

위에서는 간단한 3가지의 docker 애플리케이션을 실행해 보았는데, pull를 하지 않더라도 로컬 컴퓨터에 해당하는 이미지가 존재하지 않는다면 기본적으로 Docker Hub에서 이미지를 가져와서 실행하는 것을 확인할 수 있다.

Comments