티스토리 뷰

* docker는 우분투 12.04부터 사용 가능

* docker를 실행하려면 반드시 64bit 운영체제 필요


* ubuntu version check


root@ip-172-31-20-199:~# cat /etc/issue
Ubuntu 18.04.1 LTS \n \l


root@ip-172-31-20-199:~# uname -a
Linux ip-172-31-20-199 4.15.0-1021-aws #21-Ubuntu SMP Tue Aug 28 10:23:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


root@ip-172-31-20-199:~# dpkg -s libc6 | grep Arch
Architecture: amd64
Multi-Arch: same


* docker 설치


root@ip-172-31-20-199:~# apt-get update
Hit:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Get:5 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Fetched 316 kB in 1s (224 kB/s)
Reading package lists... Done

root@ip-172-31-20-199:~# apt-get -y install docker.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  containerd.io
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  bridge-utils cgroupfs-mount pigz ubuntu-fan
Suggested packages:
  ifupdown aufs-tools docker-doc rinse zfs-fuse | zfsutils
The following packages will be REMOVED:
  docker-ce docker-ce-cli
The following NEW packages will be installed:
  bridge-utils cgroupfs-mount docker.io pigz ubuntu-fan
0 upgraded, 5 newly installed, 2 to remove and 85 not upgraded.
Need to get 40.3 MB of archives.
After this operation, 43.2 MB of additional disk space will be used.
Get:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/universe amd64 pigz amd64 2.4-1 [57.4 kB]
Get:2 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 bridge-utils amd64 1.5-15ubuntu1 [30.1 kB]
Get:3 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/universe amd64 cgroupfs-mount all 1.4 [6320 B]
Get:4 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 docker.io amd64 18.06.1-0ubuntu1.2~18.04.1 [40.2 MB]
Get:5 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 ubuntu-fan all 0.12.10 [34.7 kB]
Fetched 40.3 MB in 1s (28.5 MB/s)
Preconfiguring packages ...
(Reading database ... 117306 files and directories currently installed.)
Removing docker-ce (5:18.09.1~3-0~ubuntu-bionic) ...
Removing docker-ce-cli (5:18.09.1~3-0~ubuntu-bionic) ...
Selecting previously unselected package pigz.
(Reading database ... 117106 files and directories currently installed.)
Preparing to unpack .../archives/pigz_2.4-1_amd64.deb ...
Unpacking pigz (2.4-1) ...
Selecting previously unselected package bridge-utils.
Preparing to unpack .../bridge-utils_1.5-15ubuntu1_amd64.deb ...
Unpacking bridge-utils (1.5-15ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../cgroupfs-mount_1.4_all.deb ...
Unpacking cgroupfs-mount (1.4) ...
Selecting previously unselected package docker.io.
Preparing to unpack .../docker.io_18.06.1-0ubuntu1.2~18.04.1_amd64.deb ...
Unpacking docker.io (18.06.1-0ubuntu1.2~18.04.1) ...
Selecting previously unselected package ubuntu-fan.
Preparing to unpack .../ubuntu-fan_0.12.10_all.deb ...
Unpacking ubuntu-fan (0.12.10) ...
Setting up docker.io (18.06.1-0ubuntu1.2~18.04.1) ...

Configuration file '/etc/init.d/docker'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** docker (Y/I/N/O/D/Z) [default=N] ? Y   ... 테스트하던 버전이 설치되어 있었다.
Installing new version of config file /etc/init.d/docker ...
Installing new version of config file /etc/init/docker.conf ...
Processing triggers for ureadahead (0.100.0-20) ...
Setting up cgroupfs-mount (1.4) ...
Setting up bridge-utils (1.5-15ubuntu1) ...
Setting up ubuntu-fan (0.12.10) ...
Created symlink /etc/systemd/system/multi-user.target.wants/ubuntu-fan.service → /lib/systemd/system/ubuntu-fan.service.
Processing triggers for systemd (237-3ubuntu10.13) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up pigz (2.4-1) ...
Processing triggers for ureadahead (0.100.0-20) ...
root@ip-172-31-20-199:~#


root@ip-172-31-20-199:~# apt-get install socat
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  containerd.io
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
  socat
0 upgraded, 1 newly installed, 0 to remove and 85 not upgraded.
Need to get 342 kB of archives.
After this operation, 1034 kB of additional disk space will be used.
Get:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 socat amd64 1.7.3.2-2ubuntu2 [342 kB]
Fetched 342 kB in 1s (383 kB/s)
Selecting previously unselected package socat.
(Reading database ... 117377 files and directories currently installed.)
Preparing to unpack .../socat_1.7.3.2-2ubuntu2_amd64.deb ...
Unpacking socat (1.7.3.2-2ubuntu2) ...
Setting up socat (1.7.3.2-2ubuntu2) ...
Processing triggers for man-db (2.8.3-2) ...
root@ip-172-31-20-199:~#



root@ip-172-31-20-199:~# systemctl start docker
Failed to start docker.service: Unit docker.service is masked.


root@ip-172-31-20-199:~# systemctl unmask docker.service
Removed /etc/systemd/system/docker.service.


root@ip-172-31-20-199:~# systemctl start docker
root@ip-172-31-20-199:~# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-03-03 13:08:48 UTC; 6s ago
     Docs: https://docs.docker.com
 Main PID: 13636 (dockerd)
    Tasks: 18
   CGroup: /system.slice/docker.service
           ├─13636 /usr/bin/dockerd -H fd://
           └─13661 docker-containerd --config /var/run/docker/containerd/containerd.toml

Mar 03 13:08:48 ip-172-31-20-199 dockerd[13636]: time="2019-03-03T13:08:48.110946751Z" level=info msg="pickfirstBalancer: HandleSubConn
Mar 03 13:08:48 ip-172-31-20-199 dockerd[13636]: time="2019-03-03T13:08:48.111596479Z" level=info msg="pickfirstBalancer: HandleSubConn
Mar 03 13:08:48 ip-172-31-20-199 dockerd[13636]: time="2019-03-03T13:08:48.111787354Z" level=info msg="Loading containers: start."
Mar 03 13:08:48 ip-172-31-20-199 dockerd[13636]: time="2019-03-03T13:08:48.249497896Z" level=info msg="Default bridge (docker0) is assi
Mar 03 13:08:48 ip-172-31-20-199 dockerd[13636]: time="2019-03-03T13:08:48.291504884Z" level=info msg="Loading containers: done."
Mar 03 13:08:48 ip-172-31-20-199 dockerd[13636]: time="2019-03-03T13:08:48.427367310Z" level=warning msg="failed to retrieve docker-run
Mar 03 13:08:48 ip-172-31-20-199 dockerd[13636]: time="2019-03-03T13:08:48.439983960Z" level=info msg="Docker daemon" commit=e68fc7a gr
Mar 03 13:08:48 ip-172-31-20-199 dockerd[13636]: time="2019-03-03T13:08:48.440262105Z" level=info msg="Daemon has completed initializat
Mar 03 13:08:48 ip-172-31-20-199 systemd[1]: Started Docker Application Container Engine.
Mar 03 13:08:48 ip-172-31-20-199 dockerd[13636]: time="2019-03-03T13:08:48.482079853Z" level=info msg="API listen on /var/run/docker.so
lines 1-20/20 (END)

root@ip-172-31-20-199:~#  docker run -it ubuntu echo Hello World!
Hello World!




cf. 루트가아닌 계정에 권한 부여하기

$ sudo groupadd docker   # Add the docker group

$ sudo gpasswd -a $(whoami) docker # Add the current user to the group

$ sudo service docker restart



댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함