Exploration of Off-line Installation of Doker 1.12.3 in ubuntu server 16.04

Keywords: Docker Ubuntu Database Linux

The original post was published in early 17 years. This time, it was re-edited and perfected with md.

copyright: wangn
This paper explores the installation of docker 1.12.3 on Ubuntu server based on LAN environment

Local area network installation and maintenance docker has always been a big problem. In short, ubuntu installation requires deb installation package, which is installed using scripts or commands after uploading offline.

So where is docker's offline package?

By searching, it is found that ubuntu can be installed using the following commands:

wget -qO- https://get.docker.com/ | sh

Note the above website: The content of the home page is as follows

#!/bin/sh
set -e
#
# This script is meant for quick & easy install via:
#   'curl -sSL https://get.docker.com/ | sh'
# or:
#   'wget -qO- https://get.docker.com/ | sh'
#
url="https://get.docker.com/"
apt_url="https://apt.dockerproject.org"
yum_url="https://yum.dockerproject.org"
gpg_fingerprint="58118E89F3A912897C070ADBF76221572C52609D"

From the intercepted part of the content, we know that the apt source is at https://apt.dockerproject.org. After opening, we can view it layer by layer.
All ubuntu docker installation packages are found at https://apt.dockerproject.org/repo/pool/main/d/docker-engine/. As for listing many versions, how to distinguish them? Please refer to: http://packages.ubuntu.com/

Well, at this point, we know that ubuntu server 16.04 is coded xenial (16.04LTS)

Download docker-engine_1.12.3-0~xenial_amd64.deb link: https://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine_1.12.3-0~xenial_amd64.deb.

Upload the deb file to the offline server and install:

# dpkg -i docker-engine_1.12.3-0-xenial_amd64.deb 
(Reading database ... 98080 files and directories currently installed.)
Preparing to unpack docker-engine_1.12.3-0-xenial_amd64.deb ...
Unpacking docker-engine (1.12.3-0~xenial) over (1.12.3-0~trusty) ...
dpkg: dependency problems prevent configuration of docker-engine:
 docker-engine depends on libltdl7 (>= 2.4.6); however:
  Package libltdl7 is not installed.
dpkg: error processing package docker-engine (--install):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
 docker-engine

At this time, the error was reported, and the libltdl7 component was missing. How many versions of this? Where to find it?
We found a networked machine and installed it for testing.

# apt-get install -y libltdl7
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libltdl7
0 upgraded, 1 newly installed, 0 to remove and 60 not upgraded.
1 not fully installed or removed.
Need to get 38.3 kB of archives.
After this operation, 85.0 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libltdl7 amd64 2.4.6-0.1 [38.3 kB]
Fetched 38.3 kB in 0s (47.2 kB/s)  
Selecting previously unselected package libltdl7:amd64.
(Reading database ... 98080 files and directories currently installed.)
Preparing to unpack .../libltdl7_2.4.6-0.1_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-0.1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Setting up libltdl7:amd64 (2.4.6-0.1) ...
Setting up docker-engine (1.12.3-0~xenial) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...

The test found that the missing file was libltdl7_2.4.6-0.1_amd64.deb
At https://pkgs.org/search for libltdl7, the following results are obtained

Now download libltdl7_2.4.6-0.1_amd64.deb and upload it to the offline server with docker-engine_1.12.3-0-xenial_amd64.deb and install it:

# dpkg -i *.deb
Selecting previously unselected package docker-engine.
(Reading database ... 90992 files and directories currently installed.)
Preparing to unpack docker-engine_1.12.3-0-xenial_amd64.deb ...
Unpacking docker-engine (1.12.3-0~xenial) ...
Selecting previously unselected package libltdl7:amd64.
Preparing to unpack libltdl7_2.4.6-0.1_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-0.1) ...
Setting up libltdl7:amd64 (2.4.6-0.1) ...
Setting up docker-engine (1.12.3-0~xenial) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...

Successful installation, start docker service

# service docker start

View service status

# service docker status
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2016-11-14 02:41:45 CST; 17s ago
     Docs: https://docs.docker.com
 Main PID: 32152 (dockerd)
   CGroup: /system.slice/docker.service
           ├─32152 /usr/bin/dockerd -H fd://
           └─32159 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-int
Nov 14 02:41:45 ubuntu dockerd[32152]: time="2016-11-14T02:41:45.577946151-06:00" level=warning msg="Your kernel does not support swap memory l
Nov 14 02:41:45 ubuntu dockerd[32152]: time="2016-11-14T02:41:45.578354605-06:00" level=info msg="Loading containers: start."
Nov 14 02:41:45 ubuntu dockerd[32152]: time="2016-11-14T02:41:45.664555247-06:00" level=info msg="Firewalld running: false"
Nov 14 02:41:45 ubuntu dockerd[32152]: time="2016-11-14T02:41:45.797725110-06:00" level=info msg="Default bridge (docker0) is assigned with an 
Nov 14 02:41:45 ubuntu dockerd[32152]: time="2016-11-14T02:41:45.845300756-06:00" level=info msg="Loading containers: done."
Nov 14 02:41:45 ubuntu dockerd[32152]: time="2016-11-14T02:41:45.845412034-06:00" level=info msg="Daemon has completed initialization"
Nov 14 02:41:45 ubuntu dockerd[32152]: time="2016-11-14T02:41:45.845429551-06:00" level=info msg="Docker daemon" commit=6b644ec graphdriver=auf
Nov 14 02:41:45 ubuntu dockerd[32152]: time="2016-11-14T02:41:45.851552715-06:00" level=info msg="API listen on /var/run/docker.sock"
Nov 14 02:41:45 ubuntu systemd[1]: Started Docker Application Container Engine.
Nov 14 02:41:58 ubuntu systemd[1]: Started Docker Application Container Engine.

View docker version information

# docker version
Client:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Wed Oct 26 22:01:48 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Wed Oct 26 22:01:48 2016
 OS/Arch:      linux/amd64

Test docker

# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
root@ubuntu:/home# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
root@ubuntu:/home# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete 
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

root@ubuntu:/home# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
c1dc24d6da4a        hello-world         "/hello"            10 seconds ago      Exited (0) 10 seconds ago                       jovial_bhaskara
root@ubuntu:/home# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              c54a2cc56cbb        4 months ago        1.848 kB

[Conclusion]

1. Believe that you already know how to install offline and master the online installation logic.
2. Installation commands and codes often hide secrets.
3,https://pkgs.org/ linux-related installation packages can be found and downloaded offline. Of course, professional packages need special web site orders, such as docker.

Posted by phpMitch on Sat, 18 May 2019 00:09:28 -0700