
우분투 20에 도커를 설치하기 위한 공식 문서는 다음과 같습니다. https://docs.docker.com/engine/install/ubuntu/ 문서를 읽는 것은 상황에 따라 달라지며, 현재 버전에 따라 간략하게 요약하겠습니다.
이전 버전의 docker를 제거합니다. 도커를 설치한 적이 없다면 건너뛸 수 있습니다.
sudo apt-get remove docker docker-engine docker.io containerd runc
apt를 업데이트하고 설치에 필요한 프로그램을 설치합니다.
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
공식 Docker GPG 키를 추가합니다.
sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
저장소를 설정합니다.
echo \
"deb (arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg) https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
도커 설치
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
hello-world 이미지를 실행해 보세요.
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://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
hello-world도 좋지만 테스트를 위해 nginx 서버를 실행하는 것도 좋습니다. 다음 기사를 참조하십시오.
Docker에서 nginx 실행
도커를 설치하고 문제 없이 테스트하는 좋은 방법은 nginx 서버를 시작하는 것입니다. 다음 명령으로 테스트할 수 있습니다. docker run –rm -p 80:80 nginx 명령은 다음과 같습니다.
junho85.pe.kr