Ubuntu에 Docker를 설치하는 단계는 다음과 같습니다.
1. 필요한 항목 설치
2. Docker 저장소 활성화 및 저장소 GPG 키를 가져오기
3. 패키지 설치
$ sudo apt-get update
$ sudo apt-get install apt-transport-https
$ sudo apt-get install ca-certificates
$ sudo apt-get install curl
$ sudo apt-get install gnupg-agent
$ sudo apt-get install software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
명령어 실행 후 다음과 같이 응답이 옵니다.
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
최신 버전의 도커를 설치합니다.
특정 버전의 도커를 설치하려면 다음과 같이 'VERSION'을 명시하여 줍니다.
sudo apt install docker-ce=<VERSION> docker-ce-cli=<VERSION> containerd.io
설치가 완료되면 도커 서비스가 자동으로 시작됩니다.
다음을 입력하여 서비스의 상태를 확인합니다.
sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2023-05-17 02:14:34 UTC; 1min 56s ago
다음과 같이 Activer: active(running) 상태임을 확인할 수 있습니다.