posted by 귀염둥이채원 2018. 12. 27. 11:40

Base Image가 CentOs인 컨테이너를 데몬 형태로 기동하는 방법을 정리한다.

Image 이름에 CentOs 버전을 입력하면 원하는 도커 이미지를 받아서 컨테이너를 생성할 수 있다.


# CentOS Docker Image tag 목록

latest, centos7, 7 (docker/Dockerfile)

centos6, 6 (docker/Dockerfile)

centos7.6.1810, 7.6.1810 (docker/Dockerfile)

centos7.5.1804, 7.5.1804 (docker/Dockerfile)

centos7.4.1708, 7.4.1708 (docker/Dockerfile)  --> centos7.4.1708 

centos7.3.1611, 7.3.1611 (docker/Dockerfile)

centos7.2.1511, 7.2.1511 (docker/Dockerfile)

centos7.1.1503, 7.1.1503 (docker/Dockerfile)

centos7.0.1406, 7.0.1406 (docker/Dockerfile)

centos6.10, 6.10 (docker/Dockerfile)

centos6.9, 6.9 (docker/Dockerfile)

centos6.8, 6.8 (docker/Dockerfile)

centos6.7, 6.7 (docker/Dockerfile)

centos6.6, 6.6 (docker/Dockerfile)


# Docker command example

docker run -d --name {Container Name} centos:{Version} /bin/bash -c "while true; do echo hello world; sleep 1; done"


# CentOs6.6 컨테이너 생성

$ docker run -d --name c6.6 centos:6.6 /bin/bash -c "while true; do echo hello world; sleep 1; done"

5956c5d1e710c7bfa42311f2900419207a4eb368c733b5ba5ae736bc536edd6b


# 컨테이너 접속

$ docker exec -it c6.6 /bin/bash


# OS 버전 확인

[root@5956c5d1e710 /]# cat /etc/*rel*

CentOS release 6.6 (Final)

cpe:/o:centos:linux:6:GA


# CentOs7.4 컨테이너 생성

$ docker run -d --name c7.4 centos:7.4.1708 /bin/bash -c "while true; do echo hello world; sleep 1; done"

Unable to find image 'centos:7.4.1708' locally

7.4.1708: Pulling from library/centos

18b8eb7e7f01: Pull complete

Digest: sha256:814ef512b757f3b515e81f60bed29909fd71bc2d3b28ec8cf025eac749712ed9

Status: Downloaded newer image for centos:7.4.1708

b61d9645aafa60560ba1abd6066079082f3fa02fbc0a39179ca0266cf3e75d51


# 컨테이너 접속

$ docker exec -it c7.4 /bin/bash


# OS 버전 확인

[root@b61d9645aafa /]# cat /etc/*rel*

CentOS Linux release 7.4.1708 (Core)

Derived from Red Hat Enterprise Linux 7.4 (Source)

NAME="CentOS Linux"

VERSION="7 (Core)"

ID="centos"

ID_LIKE="rhel fedora"

VERSION_ID="7"

PRETTY_NAME="CentOS Linux 7 (Core)"

ANSI_COLOR="0;31"

CPE_NAME="cpe:/o:centos:centos:7"

HOME_URL="https://www.centos.org/"

BUG_REPORT_URL="https://bugs.centos.org/"


CENTOS_MANTISBT_PROJECT="CentOS-7"

CENTOS_MANTISBT_PROJECT_VERSION="7"

REDHAT_SUPPORT_PRODUCT="centos"

REDHAT_SUPPORT_PRODUCT_VERSION="7"


cat: /etc/prelink.conf.d: Is a directory

CentOS Linux release 7.4.1708 (Core)

CentOS Linux release 7.4.1708 (Core)


# 참고 사이트

https://hub.docker.com/_/centos/