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

 

Install Docker Engine

 

docs.docker.com

Docker가 무엇인지 알아보기

는 잠시 뒤로 미뤄두고 일단 설치 먼저 합니다

 

지원하는 플랫폼 확인

 

Docker는 3가지 채널을 통해 업데이트됩니다

Stable, Test, Nightly

 

안전하게 Stable 사용할께요

 

Prerequisites 사전에 확인해야 할 내용

 

  • OS 버전 확인
  • repository 확인
  • 옛날 버전 Docker 삭제
sudo yum remove docker \
                docker-client \
                docker-client-latest \
                docker-common \
                docker-latest \
                docker-latest-logrotate \
                docker-logrotate \
                docker-engine

 

repository에서 설치하기

sudo yum install -y yum-utils

sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

 

이제 진짜 Docker Engine 설치하기

sudo yum install docker-ce docker-ce-cli containerd.io

 

Docker 시작하기

sudo systemctl start docker

 

재부팅 시에도 Docker 자동으로 실행되게 하기

sudo systemctl enable docker
sudo systemctl daemon-reload
sudo systemctl restart docker

 

Docker Engine이 잘 설치되었는지 확인하기

sudo docker run hello-world

------------------------------------------------------------------------------------

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete 
Digest: sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

 

 

번외로 계속 sudo 명령어를 쓰기 귀찮으니 아래 명령어를 통해 현재 사용자를 docker 그룹에 추가해요

sudo usermod -aG docker $USER

Shell에 다시 접속하면 sudo 명령어 없이 docker 실행 가능해요