Docker install

Jinha Song·2021년 1월 7일
0

Ubuntu

다음 공식 문서를 참조: Get Docker CE for Ubuntu

Requirements

sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

apt key 및 repository 추가

apt key 추가

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

apt key 추가 확인

sudo apt-key fingerprint 0EBFCD88
  • 다음 출력을 확인
pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) <docker@docker.com>
sub   4096R/F273FCD8 2017-02-22

apt repository 추가

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update

Install Docker

Docker 설치

sudo apt-get install -y docker-ce

설치된 Docker 테스트

sudo docker run hello-world
  • 다음 출력을 확인
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://cloud.docker.com/
 
For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

특정 user에 Docker 실행권한 부여

sudo usermod -aG docker $USER
sudo reboot

Raspberry PI

다음 공식 문서를 참조: Get Docker CE for Debian

Requirements

sudo apt update
sudo apt install -y \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg2 \
     software-properties-common

apt key 및 repository 추가

apt key 추가

curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -

apt repository 추가

echo "deb [arch=armhf] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
     $(lsb_release -cs) stable" | \
    sudo tee /etc/apt/sources.list.d/docker.list
sudo apt update

Install Docker

sudo apt install docker-ce
sudo systemctl enable docker
sudo systemctl start docker

설치된 Docker 테스트

docker run --rm arm32v7/hello-world

특정 user에 Docker 실행 권한 부여

sudo usermod -aG docker pi
sudo reboot
profile
Jinha Song

0개의 댓글