본문 바로가기
IT-개발

docker - Docker 설치 (ubuntu)

by 로데안 2024. 6. 17.

Docker 로고

 

prologue
도커 싫어했던 이유는?
> 굳이 왜 써야 하는지 이해가 안 됐습니다. 세부 설정하는 데는 오히려 standalone 설치가 편합니다. 심지어 쉽게 지웠다 썼다 하는 게 너무 소모적이라 생각해서 안 좋아했었다는..
왜 쓰기 시작했죠?

> 개발환경 구성이 너무 편했어요..
  덕분에 다기종 DB(mariadb, mysql, oracle, mssql, postgresql) 테스트를 쉽게 할 수 있었죠.
  (회사엔 MSSQL 등을 테스트할 환경이 없었음.. 이걸 된다고 넘겨서... ㅠㅠ)
다른 장점은?
> 윈도우에서는 WSL 서비스로 연결되니 시스템 내부(ex) Oracle)의 오염이나 자원관리를 좀 더 편하게 할 수 있어서 썼습니다.
썼다 지웠다가 너무 쉬워서
소모적인 시스템인 줄 로만 알았지..
개발 환경 구성에서는 >>>최고<<<

 

 

Docker install (ubuntu)

 

#관리자 권한으로 실행

$ apt install docker.io

하게 되면 아래와 같이 진행된다.

이러면 설치는 끝.

더보기

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  bridge-utils containerd dns-root-data dnsmasq-base git git-man iptables less liberror-perl libip4tc2 libip6tc2 libjansson4 libnetfilter-conntrack3 libnfnetlink0 libnftables1 libnftnl11 netcat-openbsd
  nftables patch pigz runc ubuntu-fan
Suggested packages:
  ifupdown aufs-tools cgroupfs-mount | cgroup-lite debootstrap docker-buildx docker-compose-v2 docker-doc rinse zfs-fuse | zfsutils git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui gitk
  gitweb git-cvs git-mediawiki git-svn firewalld ed diffutils-doc
The following NEW packages will be installed:
  bridge-utils containerd dns-root-data dnsmasq-base docker.io git git-man iptables less liberror-perl libip4tc2 libip6tc2 libjansson4 libnetfilter-conntrack3 libnfnetlink0 libnftables1 libnftnl11
  netcat-openbsd nftables patch pigz runc ubuntu-fan
0 upgraded, 23 newly installed, 0 to remove and 27 not upgraded.
Need to get 82.9 MB of archives.
After this operation, 318 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://kr.archive.ubuntu.com/ubuntu noble/universe amd64 pigz amd64 2.8-1 [65.6 kB]
Get:2 http://kr.archive.ubuntu.com/ubuntu noble-updates/main amd64 less amd64 590-2ubuntu2.1 [142 kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 netcat-openbsd amd64 1.226-1ubuntu2 [44.3 kB]
Get:4 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 libip4tc2 amd64 1.8.10-3ubuntu2 [23.3 kB]
Get:5 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 libip6tc2 amd64 1.8.10-3ubuntu2 [23.7 kB]
Get:6 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 libnfnetlink0 amd64 1.0.2-2build1 [14.8 kB]
Get:7 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 libnetfilter-conntrack3 amd64 1.0.9-6build1 [45.2 kB]
Get:8 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 libnftnl11 amd64 1.2.6-2build1 [66.0 kB]
Get:9 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 iptables amd64 1.8.10-3ubuntu2 [381 kB]
Get:10 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 libjansson4 amd64 2.14-2build2 [32.8 kB]
Get:11 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 libnftables1 amd64 1.0.9-1build1 [358 kB]
Get:12 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 nftables amd64 1.0.9-1build1 [69.8 kB]
Get:13 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 bridge-utils amd64 1.7.1-1ubuntu2 [33.9 kB]
Get:14 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 runc amd64 1.1.12-0ubuntu3 [8599 kB]
Get:15 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 containerd amd64 1.7.12-0ubuntu4 [38.6 MB]
Get:16 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 dns-root-data all 2023112702~willsync1 [4450 B]
Get:17 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 dnsmasq-base amd64 2.90-2build2 [375 kB]
Get:18 http://kr.archive.ubuntu.com/ubuntu noble/universe amd64 docker.io amd64 24.0.7-0ubuntu4 [29.1 MB]
Get:19 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 liberror-perl all 0.17029-2 [25.6 kB]
Get:20 http://kr.archive.ubuntu.com/ubuntu noble-updates/main amd64 git-man all 1:2.43.0-1ubuntu7.1 [1100 kB]
Get:21 http://kr.archive.ubuntu.com/ubuntu noble-updates/main amd64 git amd64 1:2.43.0-1ubuntu7.1 [3679 kB]
Get:22 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 patch amd64 2.7.6-7build3 [104 kB]
Get:23 http://kr.archive.ubuntu.com/ubuntu noble/universe amd64 ubuntu-fan all 0.12.16 [35.2 kB]
Fetched 82.9 MB in 18s (4698 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package pigz.
(Reading database ... 89959 files and directories currently installed.)
Preparing to unpack .../00-pigz_2.8-1_amd64.deb ...
Unpacking pigz (2.8-1) ...
Selecting previously unselected package less.
Preparing to unpack .../01-less_590-2ubuntu2.1_amd64.deb ...
Unpacking less (590-2ubuntu2.1) ...
Selecting previously unselected package netcat-openbsd.
Preparing to unpack .../02-netcat-openbsd_1.226-1ubuntu2_amd64.deb ...
Unpacking netcat-openbsd (1.226-1ubuntu2) ...
Selecting previously unselected package libip4tc2:amd64.
Preparing to unpack .../03-libip4tc2_1.8.10-3ubuntu2_amd64.deb ...
Unpacking libip4tc2:amd64 (1.8.10-3ubuntu2) ...
Selecting previously unselected package libip6tc2:amd64.
Preparing to unpack .../04-libip6tc2_1.8.10-3ubuntu2_amd64.deb ...
Unpacking libip6tc2:amd64 (1.8.10-3ubuntu2) ...
Selecting previously unselected package libnfnetlink0:amd64.
Preparing to unpack .../05-libnfnetlink0_1.0.2-2build1_amd64.deb ...
Unpacking libnfnetlink0:amd64 (1.0.2-2build1) ...
Selecting previously unselected package libnetfilter-conntrack3:amd64.
Preparing to unpack .../06-libnetfilter-conntrack3_1.0.9-6build1_amd64.deb ...
Unpacking libnetfilter-conntrack3:amd64 (1.0.9-6build1) ...
Selecting previously unselected package libnftnl11:amd64.
Preparing to unpack .../07-libnftnl11_1.2.6-2build1_amd64.deb ...
Unpacking libnftnl11:amd64 (1.2.6-2build1) ...
Selecting previously unselected package iptables.
Preparing to unpack .../08-iptables_1.8.10-3ubuntu2_amd64.deb ...
Unpacking iptables (1.8.10-3ubuntu2) ...
Selecting previously unselected package libjansson4:amd64.
Preparing to unpack .../09-libjansson4_2.14-2build2_amd64.deb ...
Unpacking libjansson4:amd64 (2.14-2build2) ...
Selecting previously unselected package libnftables1:amd64.
Preparing to unpack .../10-libnftables1_1.0.9-1build1_amd64.deb ...
Unpacking libnftables1:amd64 (1.0.9-1build1) ...
Selecting previously unselected package nftables.
Preparing to unpack .../11-nftables_1.0.9-1build1_amd64.deb ...
Unpacking nftables (1.0.9-1build1) ...
Selecting previously unselected package bridge-utils.
Preparing to unpack .../12-bridge-utils_1.7.1-1ubuntu2_amd64.deb ...
Unpacking bridge-utils (1.7.1-1ubuntu2) ...
Selecting previously unselected package runc.
Preparing to unpack .../13-runc_1.1.12-0ubuntu3_amd64.deb ...
Unpacking runc (1.1.12-0ubuntu3) ...
Selecting previously unselected package containerd.
Preparing to unpack .../14-containerd_1.7.12-0ubuntu4_amd64.deb ...
Unpacking containerd (1.7.12-0ubuntu4) ...
Selecting previously unselected package dns-root-data.
Preparing to unpack .../15-dns-root-data_2023112702~willsync1_all.deb ...
Unpacking dns-root-data (2023112702~willsync1) ...
Selecting previously unselected package dnsmasq-base.
Preparing to unpack .../16-dnsmasq-base_2.90-2build2_amd64.deb ...
Unpacking dnsmasq-base (2.90-2build2) ...
Selecting previously unselected package docker.io.
Preparing to unpack .../17-docker.io_24.0.7-0ubuntu4_amd64.deb ...
Unpacking docker.io (24.0.7-0ubuntu4) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../18-liberror-perl_0.17029-2_all.deb ...
Unpacking liberror-perl (0.17029-2) ...
Selecting previously unselected package git-man.
Preparing to unpack .../19-git-man_1%3a2.43.0-1ubuntu7.1_all.deb ...
Unpacking git-man (1:2.43.0-1ubuntu7.1) ...
Selecting previously unselected package git.
Preparing to unpack .../20-git_1%3a2.43.0-1ubuntu7.1_amd64.deb ...
Unpacking git (1:2.43.0-1ubuntu7.1) ...
Selecting previously unselected package patch.
Preparing to unpack .../21-patch_2.7.6-7build3_amd64.deb ...
Unpacking patch (2.7.6-7build3) ...
Selecting previously unselected package ubuntu-fan.
Preparing to unpack .../22-ubuntu-fan_0.12.16_all.deb ...
Unpacking ubuntu-fan (0.12.16) ...
Setting up libip4tc2:amd64 (1.8.10-3ubuntu2) ...
Setting up libip6tc2:amd64 (1.8.10-3ubuntu2) ...
Setting up netcat-openbsd (1.226-1ubuntu2) ...
update-alternatives: using /bin/nc.openbsd to provide /bin/nc (nc) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/nc.1.gz because associated file /usr/share/man/man1/nc_openbsd.1.gz (of link group nc) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/netcat.1.gz because associated file /usr/share/man/man1/nc_openbsd.1.gz (of link group nc) doesn't exist
Setting up less (590-2ubuntu2.1) ...
Setting up libnftnl11:amd64 (1.2.6-2build1) ...
Setting up runc (1.1.12-0ubuntu3) ...
Setting up libjansson4:amd64 (2.14-2build2) ...
Setting up dns-root-data (2023112702~willsync1) ...
Setting up liberror-perl (0.17029-2) ...
Setting up patch (2.7.6-7build3) ...
Setting up bridge-utils (1.7.1-1ubuntu2) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 79.)
debconf: falling back to frontend: Readline
Setting up pigz (2.8-1) ...
Setting up libnfnetlink0:amd64 (1.0.2-2build1) ...
Setting up git-man (1:2.43.0-1ubuntu7.1) ...
Setting up containerd (1.7.12-0ubuntu4) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /usr/lib/systemd/system/containerd.service.
Setting up libnftables1:amd64 (1.0.9-1build1) ...
Setting up nftables (1.0.9-1build1) ...
Setting up git (1:2.43.0-1ubuntu7.1) ...
Setting up libnetfilter-conntrack3:amd64 (1.0.9-6build1) ...
Setting up iptables (1.8.10-3ubuntu2) ...
update-alternatives: using /usr/sbin/iptables-legacy to provide /usr/sbin/iptables (iptables) in auto mode
update-alternatives: using /usr/sbin/ip6tables-legacy to provide /usr/sbin/ip6tables (ip6tables) in auto mode
update-alternatives: using /usr/sbin/iptables-nft to provide /usr/sbin/iptables (iptables) in auto mode
update-alternatives: using /usr/sbin/ip6tables-nft to provide /usr/sbin/ip6tables (ip6tables) in auto mode
update-alternatives: using /usr/sbin/arptables-nft to provide /usr/sbin/arptables (arptables) in auto mode
update-alternatives: using /usr/sbin/ebtables-nft to provide /usr/sbin/ebtables (ebtables) in auto mode
Setting up docker.io (24.0.7-0ubuntu4) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 79.)
debconf: falling back to frontend: Readline
info: Selecting GID from range 100 to 999 ...
info: Adding group `docker' (GID 105) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /usr/lib/systemd/system/docker.socket.
Setting up dnsmasq-base (2.90-2build2) ...
Setting up ubuntu-fan (0.12.16) ...
Created symlink /etc/systemd/system/multi-user.target.wants/ubuntu-fan.service → /usr/lib/systemd/system/ubuntu-fan.service.
Processing triggers for dbus (1.14.10-4ubuntu4) ...
Processing triggers for libc-bin (2.39-0ubuntu8.2) ...
Scanning processes...
Scanning processor microcode...
Scanning linux images...

Running kernel seems to be up-to-date.

The processor microcode seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

 

Docker 이해하기

 

이미 많이 사용하고 있는 Docker 겠지만

Docker는 여러 컨테이너를 관리하는 프로그램이며

컨테이너를 생성할 때는 이미지(프로그램 조형틀)를 지정해서 넣어준다. 라고 생각하면 좀 이해하기 쉬울까?

Docker의 리소스(CPU자원, Ram 할당 등)를 잡아두면 내부의 컨테이너들이 리소스를 나눠서 사용하니.. 관리하기 쉽다.

 

 

Docker image pull (feat. mariadb 11.4.2 version)

 

컨테이너에 사용할 이미지는 https://hub.docker.com 에서 검색하면 됩니다.

 

# mariadb 이미지의 11.4.2 버전(존재하는지 배포 페이지에서 확인)을 pull
# 관리자 권한으로 실행

$ docker pull mariadb:11.4.2

 

완료하면 아래처럼 Pull complete로 모두 출력되면서 쉘로 돌아온다.

더보기

11.4.2: Pulling from library/mariadb
00d679a470c4: Pull complete
5eddd2b094bc: Pull complete
c7bae458de01: Pull complete
60fd58cc8d1b: Pull complete
b44b62991c05: Pull complete
f5dedb1c2846: Pull complete
fa481306a939: Pull complete
689797659655: Pull complete
Digest: sha256:934277de8883c061e32a21d01c64973b28272b441a3f797faf189c045a7c0a51
Status: Downloaded newer image for mariadb:11.4.2
docker.io/library/mariadb:11.4.2

이런방식으로 이미지를 pull 합니다.

 

2024.07.01 - [IT-개발] - docker - mariaDB 공식 이미지로 컨테이너 생성/설정

 

docker - mariaDB 공식 이미지로 컨테이너 생성/설정

prologue특별히 정리한 이유는? > 머리속을 비우기 위해서..?docker에 돌리는 mariadb 이지만standalone으로 사용하는 것 처럼. 관련 글 참조 :2024.06.17 - [IT-개발] - docker - Docker 설치 (ubuntu) Image Pull (Docker)

lodean9.tistory.com

 

 

 

Epilogue

 

Docker는 빠른 개발 환경 구축에 최적이다.

Docker 명령어가 어렵거나 복잡하다고 생각한다면 윈도우용 docker로 컨테이너를 구성한 후에 run 명령어를 추출해서 사용하면 편하다.

반응형