DevOps/Docker

VirtualBox에 Docker 환경 구성

yscho03 2022. 5. 11. 10:16
728x90
반응형

구성 환경

  • CentOS 7 (Minimal Version) Image
  • VirtualBox

 

구성 방법

1. 이미지 다운로드

http://isoredirect.centos.org/centos/7/isos/x86_64/

첫번째 링크를 클릭한다.

 

CentOS-7-x86_64-Minimal-2009.iso를 선택한다.

2. 가상 머신 만들기

새로 만들기를 클릭한다.

하기와 같이 머신 폴더 및 Linux 종류를 설정한다.

여유롭게 공간을 사용하기 위하여 50GB를 지정하였다.

3. 가상 머신 환경 구성

부팅 순서에서 불필요한 플로피 제거한다.

4. CentOS 설치

4. 포트 포워딩

[root@localhost ~]# yum install -y net-tools
...
[root@localhost ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::13ee:dcd1:152a:119f  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:f9:db:19  txqueuelen 1000  (Ethernet)
        RX packets 16025  bytes 23613248 (22.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3692  bytes 240550 (234.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

5. Docker 설치

1. 필수 패키지 설치

[root@localhost ~]# yum install -y yum-utils
Running transaction
  Updating   : libxml2-2.9.1-6.el7_9.6.x86_64                                                                                                                                                                                  1/6 
  Installing : libxml2-python-2.9.1-6.el7_9.6.x86_64                                                                                                                                                                           2/6 
  Installing : python-chardet-2.2.1-3.el7.noarch                                                                                                                                                                               3/6 
  Installing : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                                                               4/6 
  Installing : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                                                                5/6 
  Cleanup    : libxml2-2.9.1-6.el7.5.x86_64                                                                                                                                                                                    6/6 
  Verifying  : python-chardet-2.2.1-3.el7.noarch                                                                                                                                                                               1/6 
  Verifying  : libxml2-2.9.1-6.el7_9.6.x86_64                                                                                                                                                                                  2/6 
  Verifying  : libxml2-python-2.9.1-6.el7_9.6.x86_64                                                                                                                                                                           3/6 
  Verifying  : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                                                               4/6 
  Verifying  : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                                                                5/6 
  Verifying  : libxml2-2.9.1-6.el7.5.x86_64                                                                                                                                                                                    6/6 

Installed:
  yum-utils.noarch 0:1.1.31-54.el7_8                                                                                                                                                                                               

Dependency Installed:
  libxml2-python.x86_64 0:2.9.1-6.el7_9.6                                       python-chardet.noarch 0:2.2.1-3.el7                                       python-kitchen.noarch 0:1.1.1-5.el7                                      

Dependency Updated:
  libxml2.x86_64 0:2.9.1-6.el7_9.6                                                                                                                                                                                                 

Complete!

2. 리포지토리 등록

[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

3. docker-ce 설치

[root@localhost ~]# yum install -y docker-ce
...
Installed:
  docker-ce.x86_64 3:20.10.15-3.el7                                                                                                                                                                                                

Dependency Installed:
  audit-libs-python.x86_64 0:2.8.5-4.el7             checkpolicy.x86_64 0:2.5-8.el7              container-selinux.noarch 2:2.119.2-1.911c772.el7_8  containerd.io.x86_64 0:1.6.4-3.1.el7  docker-ce-cli.x86_64 1:20.10.15-3.el7 
  docker-ce-rootless-extras.x86_64 0:20.10.15-3.el7  docker-scan-plugin.x86_64 0:0.17.0-3.el7    fuse-overlayfs.x86_64 0:0.7.2-6.el7_8               fuse3-libs.x86_64 0:3.6.1-4.el7       libcgroup.x86_64 0:0.41-21.el7        
  libsemanage-python.x86_64 0:2.5-14.el7             policycoreutils-python.x86_64 0:2.5-34.el7  python-IPy.noarch 0:0.75-6.el7                      setools-libs.x86_64 0:3.3.8-4.el7     slirp4netns.x86_64 0:0.4.3-4.el7_8    

Complete!

4. sytemctl 활성화

[root@localhost ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@localhost ~]# systemctl start docker

5. 확인

[root@localhost ~]# docker --version
Docker version 20.10.15, build fd82621

 

728x90
반응형