반응형
Docker를 사용하는 회사들이 많아서 Linux-Ubuntu에서 Docker 설치하는 방법에 관해서 소개합니다.
Docker 설치 방법 및 순서
1. Ubuntu를 apt-get 통해서 update 합니다.
aurumguide@ubuntu:~$ sudo apt-get update
2. Docker 설치하기 위한 패키지 설치 합니다.
aurumguide@ubuntu:~$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
- 실행결과 화면.
aurumguide@ubuntu:~$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20230311ubuntu0.22.04.1).
curl is already the newest version (7.81.0-1ubuntu1.16).
gnupg-agent is already the newest version (2.2.27-3ubuntu2.1).
apt-transport-https is already the newest version (2.4.11).
software-properties-common is already the newest version (0.99.22.8).
0 upgraded, 0 newly installed, 0 to remove and 50 not upgraded.
3. Docker의 공식 GPG키를 추가합니다.
aurumguide@ubuntu:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- 실행결과 화면.
aurumguide@ubuntu:~$ 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
4. Docker의 공식 apt repository를 추가합니다.
aurumguide@ubuntu:~$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- 중간에 계속 진행하려면 ENTER 치세요.
aurumguide@ubuntu:~$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Repository: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable'
Description:
Archive for codename: jammy components: stable
More info: https://download.docker.com/linux/ubuntu
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Found existing deb entry in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list
Adding deb entry to /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list
Found existing deb-src entry in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list
Hit:1 https://packages.microsoft.com/repos/edge stable InRelease
5. Ubuntu를 apt-get 통해서 업데이트합니다.
aurumguide@ubuntu:~$ sudo apt-get update
6. Docker 엔진을 설치합니다.
aurumguide@ubuntu:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
- 중간에 계속 진행하려면 'Y' 입력하세요.
aurumguide@ubuntu:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
docker-buildx-plugin docker-ce-rootless-extras libslirp0 pigz slirp4netns
Suggested packages:
aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin libslirp0 pigz slirp4netns
The following packages will be upgraded:
containerd.io
1 upgraded, 8 newly installed, 0 to remove and 49 not upgraded.
Need to get 122 MB of archives.
After this operation, 318 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
-- 생략 --
7. Docker가 설치 확인합니다.
-- 설치 버전 확인
aurumguide@ubuntu:~$ sudo docker version
-- 도커 실행 상태 확인
aurumguide@ubuntu:~$ sudo systemctl status docker
-- 도커 실행
aurumguide@ubuntu:~$ sudo docker run hello-world
8. Docker 실행 상태를 확인합니다.
aurumguide@ubuntu:~$ sudo docker ps -a
Docker 실행을 확인 가능합니다.
aurumguide@ubuntu:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5745b9cfe72e hello-world "/hello" 33 seconds ago Exited (0) 31 seconds ago determined_northcutt
반응형