본문 바로가기
Tech/Linux

Ubuntu 20.04에 Docker 설치 하기

by 타이호 2020. 5. 5.
반응형

Ubuntu 20.04가 4월말에 Release되고 난 뒤 오라클 클라우드에도 Image가 배포되어 생성해 보았다. 서버 버전이라 특별히 바뀐것은 잘 모르겠고, 제일 많이 쓰는 Docker를 설치해본다.

 

1. 서버 버전  확인

ubuntu@ubuntu01:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal

 

2. Docker 설치

ubuntu@ubuntu01:~$ sudo apt install docker.io
Reading package lists... Done            
Building dependency tree                 
Reading state information... Done              
The following additional packages will be installed:
  bridge-utils cgroupfs-mount containerd dns-root-data dnsmasq-base libidn11 pigz runc ubuntu-fan
Suggested packages:                
  ifupdown aufs-tools debootstrap docker-doc rinse zfs-fuse | zfsutils
The following NEW packages will be installed:                                                                                                                                                                                               
  bridge-utils cgroupfs-mount containerd dns-root-data dnsmasq-base docker.io libidn11 pigz runc ubuntu-fan
0 upgraded, 10 newly installed, 0 to remove and 15 not upgraded.
Need to get 69.7 MB of archives.
After this operation, 334 MB of additional disk space will be used.                                        
Do you want to continue? [Y/n] y                                                                                      
Get:1 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal/universe amd64 pigz amd64 2.4-1 [57.4 kB]
Get:2 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal/main amd64 bridge-utils amd64 1.6-2ubuntu1 [30.5 kB]
Get:3 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal/universe amd64 cgroupfs-mount all 1.4 [6320 B]                                                                                                                          
Get:4 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal/main amd64 runc amd64 1.0.0~rc10-0ubuntu1 [2549 kB]
Get:5 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal/main amd64 containerd amd64 1.3.3-0ubuntu2 [27.8 MB]                                                                                                                   
Get:6 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal/main amd64 dns-root-data all 2019052802 [5300 B]                                                                                                                        
Get:7 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal/main amd64 libidn11 amd64 1.33-2.2ubuntu2 [46.2 kB]                                                                                                                    
Get:8 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal/main amd64 dnsmasq-base amd64 2.80-1.1ubuntu1 [314 kB]                                                                                                                 
Get:9 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal/universe amd64 docker.io amd64 19.03.8-0ubuntu1 [38.9 MB]      

 

3. Docker 설정

# docker를 시스템에 등록
ubuntu@ubuntu01:~$ sudo systemctl enable --now docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.

# 일반 유저에서 sudo 명령 없이 docker 명령어 사용. 명령어 적용 후 login을 다시 해야 함
ubuntu@ubuntu01:~$ sudo usermod -aG docker ubuntu

# docker version 확인
ubuntu@ubuntu01:~$ docker version
Client:
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.13.8
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 23:42:35 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.8
  Git commit:       afacb8b7f0
  Built:            Wed Mar 11 22:48:33 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.3-0ubuntu2
  GitCommit:        
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:        

 

4. Docker 테스트

ubuntu@ubuntu01:~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:8e3114318a995a1ee497790535e7b88365222a21771ae7e53687ad76563e8e76
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/
반응형