[Docker] 설치

Dev.Hammy·2023년 8월 19일
0

Etc

목록 보기
9/20

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

(1) 기존에 설치되어 있던 도커 관련 프로그램 모두 삭제

dev_hammy@treadmill:~/Dev$ for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done

...(중략)

dev_hammy@treadmill:~/Dev$ sudo apt-get update

(2) HTTPS를 통해 리포지토리를 사용할 수 있도록 패키지 인덱스를 apt로 업데이트 후 패키지 설치

dev_hammy@treadmill:~/Dev$ sudo apt-get install ca-certificates curl gnupg
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다... 완료
상태 정보를 읽는 중입니다... 완료        
패키지 ca-certificates는 이미 최신 버전입니다 (20230311ubuntu0.22.04.1).
ca-certificates 패키지는 수동설치로 지정합니다.
패키지 curl는 이미 최신 버전입니다 (7.81.0-1ubuntu1.13).
패키지 gnupg는 이미 최신 버전입니다 (2.2.27-3ubuntu2.1).
gnupg 패키지는 수동설치로 지정합니다.
0개 업그레이드, 0개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.

(3) Docker의 공식 GPG 키를 추가

dev_hammy@treadmill:~/Dev$ sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

(4) 다음 명령을 사용하여 리포지토리를 설정

dev_hammy@treadmill:~/Dev$ echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

(5) 패키지 색인 업데이트

dev_hammy@treadmill:~/Dev$ sudo apt-get update
받기:1 https://download.docker.com/linux/ubuntu jammy InRelease [48.9 kB]
받기:2 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages [21.4 kB]
기존:3 https://dl.google.com/linux/chrome/deb stable InRelease                 
기존:4 http://security.ubuntu.com/ubuntu jammy-security InRelease              
기존:5 http://kr.archive.ubuntu.com/ubuntu jammy InRelease                     
기존:6 http://kr.archive.ubuntu.com/ubuntu jammy-updates InRelease
기존:7 http://kr.archive.ubuntu.com/ubuntu jammy-backports InRelease
내려받기 70.3 k바이트, 소요시간 2(29.1 k바이트/초)
패키지 목록을 읽는 중입니다... 완료

(6) Docker Engine, containerd 및 Docker Compose를 설치

dev_hammy@treadmill:~/Dev$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

...(중략)

(7) 잘 설치되었는지 확인

dev_hammy@treadmill:~/Dev$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
719385e32844: Pull complete 
Digest: sha256:dcba6daec718f547568c562956fa47e1b03673dd010fe6ee58ca806767031d1c
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/

0개의 댓글