본문 바로가기

리눅스

[draft] 우분투에서 최신 버전의 Docker를 설치하는 방법

728x90

우분투 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

설치 내용을 미리 확인 (실제 설치는 아님)

sudo bash get-docker.sh --dry-run

Docker 설치 스크립트를 실행하여 Docker 설치

sudo bash 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