Setting up Docker Engine in a non-internet connection

Work memo of how to set up Docker Engine in a non-Internet connection environment such as an in-house development environment

Prerequisite environment

--Prepare the environment on AWS for verification.

Usage AMI: RHEL-7.1_HVM-20150803-x86_64-1-Hourly2-GP2 Instance type: t2.medium (2vCPU / 4GiB)

RHEL7.1 environment


Red Hat Enterprise Linux Server release 7.1 (Maipo)

Preparing to install Docker

If it is an internet connection environment, follow the procedure below and use yum install, but this time it is a non-internet connection environment, so prepare the necessary rpm while resolving the dependency http://docs.docker.jp/engine/installation/linux/rhel.html

--Download the complete Docker Engine package from the Red Hat Customer Portal

Required RPM list


[root@ip-172-31-47-162 docker]# ls -ltr 
total 13100
-rw-r--r--. 1 ec2-user ec2-user   56232 Sep 22 06:16 docker-selinux-1.6.2-14.el7.x86_64.rpm
-rw-r--r--. 1 ec2-user ec2-user 7969356 Sep 22 06:19 docker-1.6.2-14.el7.x86_64.rpm
-rw-r--r--. 1 ec2-user ec2-user  918432 Sep 22 06:20 lvm2-2.02.115-3.el7_1.2.x86_64.rpm
-rw-r--r--. 1 ec2-user ec2-user  783492 Sep 22 06:22 lvm2-libs-2.02.115-3.el7_1.2.x86_64.rpm
-rw-r--r--. 1 ec2-user ec2-user  214388 Sep 22 06:28 device-mapper-1.02.93-3.el7_1.2.x86_64.rpm
-rw-r--r--. 1 ec2-user ec2-user  162532 Sep 22 06:28 device-mapper-event-1.02.93-3.el7_1.2.x86_64.rpm
-rw-r--r--. 1 ec2-user ec2-user  155168 Sep 22 06:28 device-mapper-event-libs-1.02.93-3.el7_1.2.x86_64.rpm
-rw-r--r--. 1 ec2-user ec2-user  265880 Sep 22 06:28 device-mapper-libs-1.02.93-3.el7_1.2.x86_64.rpm
-rw-r--r--. 1 ec2-user ec2-user 2869284 Sep 22 06:28 device-mapper-persistent-data-0.3.2-1.el7.x86_64.rpm
[root@ip-172-31-47-162 docker]#

--First, download "docker-1.6.2-14", which is the main package of Docker Engine, and extract the dependent packages with yum local install. --The new Docker Engine version is troublesome due to dependency hell, so I dare to select the old version (the one that seems to have a high affinity with RHEL 7.1). .. .. --Download the required packages from the Red Hat Customer Portal and transfer them to the RHEL environment on AWS via SCP. --In order to create a non-Internet connection environment, all outbound EC2 security groups are set to be rejected. (This makes it impossible to connect to the Internet from EC2.) --With the default repo setting, the following error is output and you cannot even local install (because outbound is rejected, you cannot query the default repo), so change the setting.

Error output


[root@ip-172-31-47-162 docker]# yum localinstall ./*
Loaded plugins: amazon-id, rhui-lb
Examining ./container-selinux-2.10-2.el7.noarch.rpm: 2:container-selinux-2.10-2.el7.noarch
Marking ./container-selinux-2.10-2.el7.noarch.rpm to be installed
Examining ./docker-1.12.6-16.el7.x86_64.rpm: 2:docker-1.12.6-16.el7.x86_64
Marking ./docker-1.12.6-16.el7.x86_64.rpm to be installed
Examining ./docker-client-1.12.6-16.el7.x86_64.rpm: 2:docker-client-1.12.6-16.el7.x86_64
Marking ./docker-client-1.12.6-16.el7.x86_64.rpm to be installed
Examining ./docker-common-1.12.6-16.el7.x86_64.rpm: 2:docker-common-1.12.6-16.el7.x86_64
Marking ./docker-common-1.12.6-16.el7.x86_64.rpm to be installed
Examining ./docker-rhel-push-plugin-1.12.6-16.el7.x86_64.rpm: 2:docker-rhel-push-plugin-1.12.6-16.el7.x86_64
Marking ./docker-rhel-push-plugin-1.12.6-16.el7.x86_64.rpm to be installed
Examining ./oci-register-machine-0-3.11.gitdd0daef.el7.x86_64.rpm: 1:oci-register-machine-0-3.11.gitdd0daef.el7.x86_64
Marking ./oci-register-machine-0-3.11.gitdd0daef.el7.x86_64.rpm to be installed
Examining ./oci-systemd-hook-0.1.4-9.git671c428.el7.x86_64.rpm: 1:oci-systemd-hook-0.1.4-9.git671c428.el7.x86_64
Marking ./oci-systemd-hook-0.1.4-9.git671c428.el7.x86_64.rpm to be installed
Examining ./skopeo-containers-0.1.20-2.el7.x86_64.rpm: 1:skopeo-containers-0.1.20-2.el7.x86_64
Marking ./skopeo-containers-0.1.20-2.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package container-selinux.noarch 2:2.10-2.el7 will be installed
--> Processing Dependency: policycoreutils >= 2.5-11 for package: 2:container-selinux-2.10-2.el7.noarch
Could not contact CDS load balancer rhui2-cds01.ap-northeast-1.aws.ce.redhat.com, trying others.


Could not contact any CDS load balancers: rhui2-cds01.ap-northeast-1.aws.ce.redhat.com, rhui2-cds02.ap-northeast-1.aws.ce.redhat.com.
[root@ip-172-31-47-162 docker]#

Change repo settings


[root@ip-172-31-47-162 yum.repos.d]# yum-config-manager --save --setopt=local-myrepository.skip_if_unavailable=true

Install Docker Engine

--Install Docker Engine with the yum local install command

Perform installation


[root@ip-172-31-47-162 docker]# yum localinstall ./*
Loaded plugins: amazon-id, rhui-lb
Examining ./device-mapper-1.02.93-3.el7_1.2.x86_64.rpm: 7:device-mapper-1.02.93-3.el7_1.2.x86_64
Marking ./device-mapper-1.02.93-3.el7_1.2.x86_64.rpm as an update to 7:device-mapper-1.02.93-3.el7_1.1.x86_64
Examining ./device-mapper-event-1.02.93-3.el7_1.2.x86_64.rpm: 7:device-mapper-event-1.02.93-3.el7_1.2.x86_64
Marking ./device-mapper-event-1.02.93-3.el7_1.2.x86_64.rpm to be installed
Examining ./device-mapper-event-libs-1.02.93-3.el7_1.2.x86_64.rpm: 7:device-mapper-event-libs-1.02.93-3.el7_1.2.x86_64
Marking ./device-mapper-event-libs-1.02.93-3.el7_1.2.x86_64.rpm to be installed
Examining ./device-mapper-libs-1.02.93-3.el7_1.2.x86_64.rpm: 7:device-mapper-libs-1.02.93-3.el7_1.2.x86_64
Marking ./device-mapper-libs-1.02.93-3.el7_1.2.x86_64.rpm as an update to 7:device-mapper-libs-1.02.93-3.el7_1.1.x86_64
Examining ./device-mapper-persistent-data-0.3.2-1.el7.x86_64.rpm: device-mapper-persistent-data-0.3.2-1.el7.x86_64
Marking ./device-mapper-persistent-data-0.3.2-1.el7.x86_64.rpm to be installed
Examining ./docker-1.6.2-14.el7.x86_64.rpm: docker-1.6.2-14.el7.x86_64
Marking ./docker-1.6.2-14.el7.x86_64.rpm to be installed
Examining ./docker-selinux-1.6.2-14.el7.x86_64.rpm: docker-selinux-1.6.2-14.el7.x86_64
Marking ./docker-selinux-1.6.2-14.el7.x86_64.rpm to be installed
Examining ./lvm2-2.02.115-3.el7_1.2.x86_64.rpm: 7:lvm2-2.02.115-3.el7_1.2.x86_64
Marking ./lvm2-2.02.115-3.el7_1.2.x86_64.rpm to be installed
Examining ./lvm2-libs-2.02.115-3.el7_1.2.x86_64.rpm: 7:lvm2-libs-2.02.115-3.el7_1.2.x86_64
Marking ./lvm2-libs-2.02.115-3.el7_1.2.x86_64.rpm to be installed
Skipping: ./old, filename does not end in .rpm.
Resolving Dependencies
--> Running transaction check
---> Package device-mapper.x86_64 7:1.02.93-3.el7_1.1 will be updated
---> Package device-mapper.x86_64 7:1.02.93-3.el7_1.2 will be an update
---> Package device-mapper-event.x86_64 7:1.02.93-3.el7_1.2 will be installed
---> Package device-mapper-event-libs.x86_64 7:1.02.93-3.el7_1.2 will be installed
---> Package device-mapper-libs.x86_64 7:1.02.93-3.el7_1.1 will be updated
---> Package device-mapper-libs.x86_64 7:1.02.93-3.el7_1.2 will be an update
---> Package device-mapper-persistent-data.x86_64 0:0.3.2-1.el7 will be installed
---> Package docker.x86_64 0:1.6.2-14.el7 will be installed
---> Package docker-selinux.x86_64 0:1.6.2-14.el7 will be installed
---> Package lvm2.x86_64 7:2.02.115-3.el7_1.2 will be installed
---> Package lvm2-libs.x86_64 7:2.02.115-3.el7_1.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                        Arch    Version               Repository                                           Size
========================================================================================================================
Installing:
 device-mapper-event            x86_64  7:1.02.93-3.el7_1.2   /device-mapper-event-1.02.93-3.el7_1.2.x86_64        37 k
 device-mapper-event-libs       x86_64  7:1.02.93-3.el7_1.2   /device-mapper-event-libs-1.02.93-3.el7_1.2.x86_64   27 k
 device-mapper-persistent-data  x86_64  0.3.2-1.el7           /device-mapper-persistent-data-0.3.2-1.el7.x86_64    17 M
 docker                         x86_64  1.6.2-14.el7          /docker-1.6.2-14.el7.x86_64                          32 M
 docker-selinux                 x86_64  1.6.2-14.el7          /docker-selinux-1.6.2-14.el7.x86_64                  25 k
 lvm2                           x86_64  7:2.02.115-3.el7_1.2  /lvm2-2.02.115-3.el7_1.2.x86_64                     1.8 M
 lvm2-libs                      x86_64  7:2.02.115-3.el7_1.2  /lvm2-libs-2.02.115-3.el7_1.2.x86_64                2.2 M
Updating:
 device-mapper                  x86_64  7:1.02.93-3.el7_1.2   /device-mapper-1.02.93-3.el7_1.2.x86_64             189 k
 device-mapper-libs             x86_64  7:1.02.93-3.el7_1.2   /device-mapper-libs-1.02.93-3.el7_1.2.x86_64        293 k

Transaction Summary
========================================================================================================================
Install  7 Packages
Upgrade  2 Packages

Total size: 54 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 7:device-mapper-1.02.93-3.el7_1.2.x86_64                                                            1/11 
  Updating   : 7:device-mapper-libs-1.02.93-3.el7_1.2.x86_64                                                       2/11 
  Installing : 7:device-mapper-event-libs-1.02.93-3.el7_1.2.x86_64                                                 3/11 
  Installing : 7:device-mapper-event-1.02.93-3.el7_1.2.x86_64                                                      4/11 
  Installing : 7:lvm2-libs-2.02.115-3.el7_1.2.x86_64                                                               5/11 
  Installing : docker-selinux-1.6.2-14.el7.x86_64                                                                  6/11 
  Installing : device-mapper-persistent-data-0.3.2-1.el7.x86_64                                                    7/11 
  Installing : 7:lvm2-2.02.115-3.el7_1.2.x86_64                                                                    8/11 
  Installing : docker-1.6.2-14.el7.x86_64                                                                          9/11 
  Cleanup    : 7:device-mapper-1.02.93-3.el7_1.1.x86_64                                                           10/11 
  Cleanup    : 7:device-mapper-libs-1.02.93-3.el7_1.1.x86_64                                                      11/11 
  Verifying  : device-mapper-persistent-data-0.3.2-1.el7.x86_64                                                    1/11 
  Verifying  : 7:lvm2-2.02.115-3.el7_1.2.x86_64                                                                    2/11 
  Verifying  : 7:device-mapper-libs-1.02.93-3.el7_1.2.x86_64                                                       3/11 
  Verifying  : 7:device-mapper-event-libs-1.02.93-3.el7_1.2.x86_64                                                 4/11 
  Verifying  : docker-1.6.2-14.el7.x86_64                                                                          5/11 
  Verifying  : 7:device-mapper-event-1.02.93-3.el7_1.2.x86_64                                                      6/11 
  Verifying  : 7:lvm2-libs-2.02.115-3.el7_1.2.x86_64                                                               7/11 
  Verifying  : 7:device-mapper-1.02.93-3.el7_1.2.x86_64                                                            8/11 
  Verifying  : docker-selinux-1.6.2-14.el7.x86_64                                                                  9/11 
  Verifying  : 7:device-mapper-1.02.93-3.el7_1.1.x86_64                                                           10/11 
  Verifying  : 7:device-mapper-libs-1.02.93-3.el7_1.1.x86_64                                                      11/11 

Installed:
  device-mapper-event.x86_64 7:1.02.93-3.el7_1.2             device-mapper-event-libs.x86_64 7:1.02.93-3.el7_1.2        
  device-mapper-persistent-data.x86_64 0:0.3.2-1.el7         docker.x86_64 0:1.6.2-14.el7                               
  docker-selinux.x86_64 0:1.6.2-14.el7                       lvm2.x86_64 7:2.02.115-3.el7_1.2                           
  lvm2-libs.x86_64 7:2.02.115-3.el7_1.2                     

Updated:
  device-mapper.x86_64 7:1.02.93-3.el7_1.2                 device-mapper-libs.x86_64 7:1.02.93-3.el7_1.2                

Complete!
[root@ip-172-31-47-162 docker]# 

Operation check after installation

--Start docker engine & check status

Start Docker Engine&Start confirmation


[root@ip-172-31-47-162 docker]# systemctl start docker 
[root@ip-172-31-47-162 docker]# 
[root@ip-172-31-47-162 docker]# systemctl status docker 
docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
   Active: active (running) since Tue 2020-09-22 06:29:23 EDT; 10s ago
     Docs: http://docs.docker.com
 Main PID: 18149 (docker)
   CGroup: /system.slice/docker.service
           └─18149 /usr/bin/docker -d --selinux-enabled --add-registry registry.access.redhat.com

Sep 22 06:29:16 ip-172-31-47-162.ap-northeast-1.compute.internal docker[18149]: time="2020-09-22T06:29:16-04:00" lev..."
Sep 22 06:29:22 ip-172-31-47-162.ap-northeast-1.compute.internal docker[18149]: time="2020-09-22T06:29:22-04:00" lev..."
Sep 22 06:29:23 ip-172-31-47-162.ap-northeast-1.compute.internal docker[18149]: time="2020-09-22T06:29:23-04:00" lev..."
Sep 22 06:29:23 ip-172-31-47-162.ap-northeast-1.compute.internal docker[18149]: time="2020-09-22T06:29:23-04:00" lev..."
Sep 22 06:29:23 ip-172-31-47-162.ap-northeast-1.compute.internal docker[18149]: time="2020-09-22T06:29:23-04:00" lev..."
Sep 22 06:29:23 ip-172-31-47-162.ap-northeast-1.compute.internal docker[18149]: time="2020-09-22T06:29:23-04:00" lev..."
Sep 22 06:29:23 ip-172-31-47-162.ap-northeast-1.compute.internal docker[18149]: time="2020-09-22T06:29:23-04:00" lev..."
Sep 22 06:29:23 ip-172-31-47-162.ap-northeast-1.compute.internal docker[18149]: time="2020-09-22T06:29:23-04:00" lev..."
Sep 22 06:29:23 ip-172-31-47-162.ap-northeast-1.compute.internal docker[18149]: time="2020-09-22T06:29:23-04:00" lev..."
Sep 22 06:29:23 ip-172-31-47-162.ap-northeast-1.compute.internal systemd[1]: Started Docker Application Container E...e.
Hint: Some lines were ellipsized, use -l to show in full.
[root@ip-172-31-47-162 docker]#
[root@ip-172-31-47-162 docker]# docker ps 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@ip-172-31-47-162 docker]# 

--Docker search command fails because external connection is not possible (as expected)

Error output


[root@ip-172-31-47-162 docker]# docker search hello-world
FATA[0127] Error response from daemon: Get https://index.docker.io/v1/search?q=hello-world: dial tcp 52.55.43.248:443: connection timed out 
[root@ip-172-31-47-162 docker]# 

Recommended Posts

Setting up Docker Engine in a non-internet connection
Japanese setting of mysql in Docker container
I tried setting up a Maven remote repository
Set up a webhook in Shopify's custom app
Docker in LXD
I tried using a database connection in Android development
Localhost3000 does not start up in Docker / Rails development.
[Note] Build a Python3 environment with Docker in EC2
Dramatically speed up slow bundle install in docker environment