나름 공부하는 일상

[Docker] ubuntu22.04에 Docker 설치하기 본문

IT 개발/ubuntu 세팅

[Docker] ubuntu22.04에 Docker 설치하기

hi_g1 2024. 2. 17. 11:19
해당 포스팅에서는 Linux(ubuntu)시스템에서 Docker를 빠르고 간단하게 설치하기 위해 get.docker.com에서 설치 스크립트를 다운로드하여 Docker를 설치하는 방법을 포함하고 있습니다.

[환경]
os: ubuntu 22.04

[다음 글]

2024.02.22 - [IT 개발/ubuntu 밀었을 때, 봐] - [Docker] 도커에서 ROS2 환경 구축하기

 

0. Docker 설치하기

아래 5단계에 걸쳐 Linux 시스템에서 Docker를 설치할 수 있으며, step2와 3의 경우 검증을 위한 단계이므로 굳이 실행할 필요가 없다.

 
step1. Docker 스크립트를 다운 받는다.

(curl 명령어가 없는 경우, 아래 명령어로 설치)

# 0.install curl
sudo apt install curl

# 1.download the script
curl -fsSL https://get.docker.com -o install-docker.sh

 

step2. 선택사항) Docker 스크립트의 내용을 검토한다.

# 2.verify the script's content
cat install-docker.sh

 

step3. 선택사항) 테스트용으로 설치해 보고 스크립트를 검증한다.

# 3.run the script with --dry-run to verify the steps it executes
sh install-docker.sh --dry-run

 

step4. 실제로 Docker 스크립트를 이용해 설치한다.

# 4.run the script either as root, or using sudo to perform the installation.
sudo sh install-docker.sh

 

step5. Docker에 권한을 부여한다. (적용을 위해 로그아웃 혹은 재부팅 필요)

# 5.Add your user to the docker group.
sudo usermod -aG docker $USER