도커(Docker) 설치하기

Dohyun Park·2023년 4월 7일

Docker Container

목록 보기
2/3

도커 설치 준비

본 게시글의 실습 환경: Ubuntu 22.04 LTS

1. 커널 버전 확인

Host OS가 최소한 3.10 버전 이상을 사용해야 Docker container를 정상적으로 사용할 수 있습니다.

# uname -r
5.15.0-1030-oracle

위 명령어를 이용하면 커널의 버전을 확인할 수 있습니다.
추가로 오래된 리눅스 배포판의 경우, 지원을 받지 못할 수 있으므로 지원 기간 내에 있는 배포판인지 확인하면 좋습니다.

2. 사용중인 리눅스가 64비트인지 확인

도커는 64비트에 최적화되어있다. 32비트 버전에서도 도커를 실행할 수 있으나, 권장되지는 않습니다.

3. root 권한이 있는 계정으로 진행

root 권한이 있는 계정으로 진행하거나 sudo 명령어를 통해 설치를 진행해야합니다.

도커 설치하기

# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# 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
.
.
.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list
.
.
.
Get:6 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages [15.5 kB]
Hit:7 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 64.4 kB in 3s (23.2 kB/s)
Reading package lists... Done

첫번째 줄의 curl 명령어를 실행한 후 2번째 줄의 add-apt-repository \ 를 입력, 그 다음 > 기호가 뜨면서 입력가능하면 "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" 를 입력합니다.

Press [ENTER] to continue or Ctrl-c to cancel. 메시지가 뜨면 엔터키를 누르면 설치됩니다.

# apt-get update
# apt-get install docker-ce

The following NEW packages will be installed:
  containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras
  docker-compose-plugin git git-man less liberror-perl libslirp0 pigz slirp4netns
0 upgraded, 13 newly installed, 0 to remove and 24 not upgraded.
Need to get 113 MB of archives.
After this operation, 416 MB of additional disk space will be used.
Do you want to continue? [Y/n]

설치된 도커 버전 확인

# docker info

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 23.0.3
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version: v1.1.5-0-gf19387a
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-1030-oracle
 Operating System: Ubuntu 22.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 964.1MiB
 Name: dhlife09-micro1
 ID: 9bca7878-3361-452c-9e0c-e0bac1da78fc
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

docker info 명령어를 통해 23.0.3 버전의 도커 엔진이 설치되었음을 확인할 수 있습니다.

profile
공부한 내용을 기록하고 생각을 정리합니다.

0개의 댓글