Docker

[Docker] 로컬 환경 구성 6 - CentOS Docker 설치

NJ94 2024. 2. 5. 13:40

1. CentOS Docker 설치

: Manuals > Docker Engine > Install > CentOs

 

https://docs.docker.com/engine/install/centos/

 

Install Docker Engine on CentOS

Learn how to install Docker Engine on CentOS. These instructions cover the different installation methods, how to uninstall, and next steps.

docs.docker.com

 

 

1.1 설치가 가능한 버전

  • CentOS 7
  • CentOS 8 (stream)
  • CentOS 9 (stream)

 

1.2 이전 버전 삭제

sudo yum remove docker \
              docker-client \
              docker-client-latest \
              docker-common \
              docker-latest \
              docker-latest-logrotate \
              docker-logrotate \
              docker-engine

 

 

1.3 루트 계정으로 접속

$ su - 
password: ...

 

 

1.4 저장소 설정

yum-utils유틸리티를 제공하는 패키지를 설치 yum-config-manager 하고 저장소를 설정합니다.

$ sudo yum install -y yum-utils
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

 

 

1.5 도커 엔진 설치

특정 버전 설치는 위의 URL 참고

$ sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

 

 

1.6. 도커 시작

$ systemctl start docker

 

 

1.7 Docker 설치 여부 확인

$ docker run hello-world

 

 

1.8 Docker 설치 완료

 

 

2. Centos 자동 실행 설정

Ubuntu는 자동으로 Docker가 실행되지만, Centos는 자동으로 실행이 안됨

 

2.1 자동 실행 확인

$ systemctl status docker

 

Loaded: disabled 설정으로 되어있음

 

 

2.2 자동 실행 설정

$ systemctl enable docker

 

 

2.3 완료

 

 

참고

[따배도] 2-4. 도커 설치하기: OS(Ubuntu/CentOS)에 Docker 설치!
https://www.youtube.com/watch?v=IJf5ioT2Iuw&list=PLApuRlvrZKogb78kKq1wRvrjg1VMwYrvi&index=7