반응형
우분투 24.04 LTS에서 최신 버전의 Docker를 설치하는 방법
Docker 공식 설치 가이드 : Install using the convenience script
테스트 환경
$ sudo lsb_release -d
Description: Ubuntu 24.04.1 LTS
Docker 설치
Docker 설치 스크립트 다운로드
curl -fsSL https://get.docker.com -o get-docker.sh
chmod +x get-docker.sh
설치 내용을 미리 확인 (실제 설치는 아님)
./get-docker.sh --dry-run
# Executing docker install script, commit: 4c94a56999e10efcf48c5b8e3f6afea464f9108e
apt-get -qq update >/dev/null
DEBIAN_FRONTEND=noninteractive apt-get -y -qq install ca-certificates curl >/dev/null
install -m 0755 -d /etc/apt/keyrings
curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu jammy stable" > /etc/apt/sources.list.d/docker.list
apt-get -qq update >/dev/null
DEBIAN_FRONTEND=noninteractive apt-get -y -qq install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin >/dev/null
Docker 설치 스크립트를 실행하여 Docker 설치
./get-docker.sh
Docker 버전 확인
sudo docker version
$ sudo docker version | grep ' Engine:' -A 1 | grep 'Version:'
Version: 27.4.1
Docker Compose 버전 확인
sudo docker compose version
$ sudo docker compose version
Docker Compose version v2.32.1
Docker 서비스를 활성화 및 시작
sudo systemctl enable --now docker
Docker 서비스를 재시작 (필요한 경우)
sudo systemctl restart docker
현재 사용자를 Docker 그룹에 추가
sudo usermod -aG docker $USER
728x90
docker.sock permission denied
docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Head "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied.
필요할 경우 임시로만 사용(비추천)$ ls -l /var/run/docker.sock srw-rw---- 1 root docker 0 Jan 13 09:27 /var/run/docker.sock
sudo chmod 666 /var/run/docker.sock
사용자 그룹 갱신 (현재 세션에서 적용)
newgrp docker
현재 사용자로 Docker 버전 확인
docker version
$ sudo docker version | grep ' Engine:' -A 1 | grep 'Version:'
Version: 27.4.1
현재 사용자로 Docker Compose 버전 확인
docker compose version
$ docker compose version
Docker Compose version v2.32.1
테스트
docker run hello-world
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:5b3cc85e16e3058003c13b7821318369dad01dac3dbb877aac3c28182255c724
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/
참고URL
- Docker Documentation : Install Docker Engine on Ubuntu
728x90
반응형
'리눅스' 카테고리의 다른 글
ps kill 명령어 (0) | 2025.01.16 |
---|---|
GitHub Actions를 사용해 Spring Boot 애플리케이션을 빌드하고 Docker 이미지를 생성하여 Docker Hub에 업로드하는 방법 (0) | 2025.01.14 |
PHP-FPM Pool을 구성하는 방법 (0) | 2025.01.14 |
NGINX에서 가상 호스트에 HTTP2를 설정하는 방법 (0) | 2025.01.08 |
tee 명령어 (0) | 2025.01.08 |