Docker is growing with amazing features, and it becomes a platform to deploy services even in embedded linux enviroment. There are different ways to install docker, one approach is to install using the pre-built binary distribution.

docker install

The following post shows what I did under ubuntu 16.04.

Let’s go through some basic steps:

Prerequistes

  • A 64-bit installation
  • Version 3.10 or higher of the Linux kernel. The latest version of the kernel available for you platform is recommended.
  • iptables version 1.4 or higher.
  • git version 1.7 or higher.
  • A ps executable, usually provided by procps or a similar package.
  • XZ Utils 4.9 or higher.
  • a properly mounted cgroupfs hierarchy; a single, all-encompassing cgroup mount point is not sufficient. See Github issues #2683, #3485, #4568).
  • iot@sgbu-ucs-11:/nobackup/docker/docker-1.13.1$ uname -a
    Linux sgbu-ucs-11 4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
    iot@sgbu-ucs-11:/nobackup/docker/docker-1.13.1$iptables --version
    iptables v1.6.0
    iot@sgbu-ucs-11:/nobackup/docker/docker-1.13.1$ git --version
    git version 2.7.4
    iot@sgbu-ucs-11:/nobackup/docker/docker-1.13.1$ which ps
    /bin/ps
    iot@sgbu-ucs-11:/nobackup/docker/docker-1.13.1$ which xz
    /usr/bin/xz
    iot@sgbu-ucs-11:/nobackup/docker/docker-1.13.1$ xz --version
    xz (XZ Utils) 5.1.0alpha
    liblzma 5.1.0alpha
    iot@sgbu-ucs-11:/nobackup/docker/docker-1.13.1$ cat /proc/filesystems | grep cgroup
    nodev	cgroup
    # Download docker binary distribution Check [GITHUB docker release site](https://github.com/docker/docker/releases) to pick a version you want, I pick version 1.13.1.
    iot@sgbu-ucs-11:/nobackup/docker$ wget  https://get.docker.com/builds/Linux/x86_64/docker-1.13.1.tgz
    --2017-03-04 15:56:54--  https://get.docker.com/builds/Linux/x86_64/docker-1.13.1.tgz
    Resolving proxy.esl.cisco.com (proxy.esl.cisco.com)... 173.36.224.109, 2001:420:620::4
    Connecting to proxy.esl.cisco.com (proxy.esl.cisco.com)|173.36.224.109|:8080... connected.
    Proxy request sent, awaiting response... 200 OK
    Length: 27851024 (27M) [application/x-tar]
    Saving to: docker-1.13.1.tgz
    
    docker-1.13.1.tgz                100%[=========================================================>]  26.56M  26.5MB/s    in 1.0s
    
    2017-03-04 15:56:55 (26.5 MB/s) - docker-1.13.1.tgz saved [27851024/27851024]
    
    iot@sgbu-ucs-11:/nobackup/docker$ ls -l docker-1.13.1.tgz
    -rw-rw-r-- 1 iot iot 27851024 Feb  8 00:52 docker-1.13.1.tgz
    iot@sgbu-ucs-11:/nobackup/docker$
    # Installation Installation is straightforward by extracting tarball, and copy the binary into a directory like "usr/bin", any directory which is part of your existing $PATH is fine.
    iot@sgbu-ucs-11:/nobackup/docker$ tar xvf docker-1.13.1.tgz && mv docker docker-1.13.1
    iot@sgbu-ucs-11:/nobackup/docker$ ls -l
    total 866320
    drwxr-xr-x  3 iot iot      4096 Feb  8 00:51 docker-1.13.1
    -rw-rw-r--  1 iot iot  27851024 Feb  8 00:52 docker-1.13.1.tgz
    iot@sgbu-ucs-11:/nobackup/docker$ ls -l docker-1.13.1
    total 82856
    drwxr-xr-x 5 iot iot     4096 Feb  8 00:51 completion
    -rwxr-xr-x 1 iot iot 14125488 Feb  8 00:51 docker
    -rwxr-xr-x 1 iot iot  8932648 Feb  8 00:51 docker-containerd
    -rwxr-xr-x 1 iot iot  8381448 Feb  8 00:51 docker-containerd-ctr
    -rwxr-xr-x 1 iot iot  3047368 Feb  8 00:51 docker-containerd-shim
    -rwxr-xr-x 1 iot iot 39941680 Feb  8 00:51 dockerd
    -rwxr-xr-x 1 iot iot   772400 Feb  8 00:51 docker-init
    -rwxr-xr-x 1 iot iot  2534781 Feb  8 00:51 docker-proxy
    -rwxr-xr-x 1 iot iot  7092736 Feb  8 00:51 docker-runc
    iot@sgbu-ucs-11:/nobackup/docker$ sudo cp docker-1.13.1/* /usr/bin
    # Run It is important to know that docker is running in a client server mode, it means that "dockerd" runs as a daemon, which is server and does all the heavy lifting work; "docker" is client tool, which used to send command to dockerd to do actual work. Here I show to run docker manually. Since my box is running inside Cisco lab, which sits behind proxy, I pass the proxy setting to dockerd directly, this works well. I ecountered erros in a apt-get docker set up case, even after I configured docker proxy under /etc/default/docker. Another thing to be aware, you need to know that docker needs storage space to store all containers, which could grow significantly depending on what you do. In my case, I create a directory "/nobackup/docker/workspace1.13.1/" as storage area.
    iot@sgbu-ucs-11:/nobackup/docker$ mkdir workspace1.13.1
    iot@sgbu-ucs-11:/nobackup/docker$ sudo https_proxy="https://proxy.esl.cisco.com:8080" http_proxy="http://proxy.esl.cisco.com:8080" dockerd -g /nobackup/docker/workspace1.13.1/ &
    [1] 10038
    iot@sgbu-ucs-11:/nobackup/docker$ INFO[0000] libcontainerd: new containerd process, pid: 10050 
    WARN[0000] containerd: low RLIMIT_NOFILE changing to max  current=1024 max=65536
    INFO[0001] [graphdriver] using prior storage driver: aufs 
    INFO[0001] Graph migration to content-addressability took 0.00 seconds 
    WARN[0001] Your kernel does not support swap memory limit 
    WARN[0001] Your kernel does not support cgroup rt period 
    WARN[0001] Your kernel does not support cgroup rt runtime 
    INFO[0001] Loading containers: start.                   
    INFO[0001] Firewalld running: false                     
    INFO[0001] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address 
    INFO[0001] Loading containers: done.                    
    WARN[0001] Couldn't run auplink before unmount /nobackup/docker/workspace1.13.1/tmp/docker-aufs-union687449707: exec: "auplink": executable file not found in $PATH 
    INFO[0001] Daemon has completed initialization          
    INFO[0001] Docker daemon                                 commit=092cba3 graphdriver=aufs version=1.13.1
    INFO[0001] API listen on /var/run/docker.sock           
    
    iot@sgbu-ucs-11:/nobackup/docker$
    iot@sgbu-ucs-11:/nobackup/docker$ ps -ef | grep docker
    root     10038  8482  0 16:18 pts/16   00:00:00 sudo https_proxy=https://proxy.esl.cisco.com:8080 http_proxy=http://proxy.esl.cisco.com:8080 dockerd -g /nobackup/docker/workspace1.13.1/
    root     10039 10038  0 16:18 pts/16   00:00:01 dockerd -g /nobackup/docker/workspace1.13.1/
    root     10050 10039  0 16:18 ?        00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc
    iot      10248  8482  0 16:22 pts/16   00:00:00 grep --color=auto docker
    iot@sgbu-ucs-11:/nobackup/docker$ 
    
    As it is shwoing, docker is running nicely.
    # Deploy containers First we make sure there is no docker images there:
    iot@sgbu-ucs-11:/nobackup/docker$ sudo docker images
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    iot@sgbu-ucs-11:/nobackup/docker$ 
    As a sanity testing, we install "hello-world" from docker hub to make sure it is working well:
    iot@sgbu-ucs-11:/nobackup/docker$ sudo docker pull hello-world
    Using default tag: latest
    latest: Pulling from library/hello-world
    78445dd45222: Already exists 
    Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
    Status: Downloaded newer image for hello-world:latest
    iot@sgbu-ucs-11:/nobackup/docker$ sudo docker images
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    hello-world         latest              48b5124b2768        7 weeks ago         1.84 kB
    iot@sgbu-ucs-11:/nobackup/docker$ 
    Second we can install a "fedora" image and "nginx" image.
    iot@sgbu-ucs-11:/nobackup/docker$ sudo docker pull fedora
    Using default tag: latest
    latest: Pulling from library/fedora
    1b39978eabd9: Pull complete 
    Digest: sha256:8d3f642aa4d3fa8f9dc52ab0e3bbbe8bc2494843dc6ebb26c4a6958db888e5a2
    Status: Downloaded newer image for fedora:latest
    iot@sgbu-ucs-11:/nobackup/docker$ sudo docker pull nginx
    Using default tag: latest
    latest: Pulling from library/nginx
    693502eb7dfb: Pull complete 
    6decb850d2bc: Pull complete 
    c3e19f087ed6: Pull complete 
    Digest: sha256:52a189e49c0c797cfc5cbfe578c68c225d160fb13a42954144b29af3fe4fe335
    Status: Downloaded newer image for nginx:latest
    iot@sgbu-ucs-11:/nobackup/docker$ sudo docker images
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    nginx               latest              6b914bbcb89e        4 days ago          182 MB
    fedora              latest              1f8ec1108a3f        2 weeks ago         230 MB
    hello-world         latest              48b5124b2768        7 weeks ago         1.84 kB
    iot@sgbu-ucs-11:/nobackup/docker$ 
    Third, let run fedora interactive through bash: it shows it is fedora 25, however you can see it is actually has ubuntu kernel since container is a user space virtualization technology.
    iot@sgbu-ucs-11:/nobackup/docker$ sudo docker run -it fedora /bin/bash
    WARN[0699] Couldn't run auplink before unmount /nobackup/docker/workspace1.13.1/aufs/mnt/f7babbdcde18ee51bc5efffbe67aff8edc734753624c91f0bfb8702ef4922d93-init: exec: "auplink": executable file not found in $PATH 
    WARN[0699] Couldn't run auplink before unmount /nobackup/docker/workspace1.13.1/aufs/mnt/f7babbdcde18ee51bc5efffbe67aff8edc734753624c91f0bfb8702ef4922d93: exec: "auplink": executable file not found in $PATH 
    INFO[0700] No non-localhost DNS nameservers are left in resolv.conf. Using default external servers: [nameserver 8.8.8.8 nameserver 8.8.4.4] 
              INFO[0700] IPv6 enabled; Adding default IPv6 external servers: [nameserver 2001:4860:4860::8888 nameserver 2001:4860:4860::8844] 
    [root@18ca8d8ced5b /]# cat /etc/fedora-release 
    Fedora release 25 (Twenty Five)
    [root@18ca8d8ced5b /]# uname -a
    Linux 18ca8d8ced5b 4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
    [root@18ca8d8ced5b /]# 
    [root@18ca8d8ced5b /]# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    none            823G   49G  733G   7% /
    tmpfs            48G     0   48G   0% /dev
    tmpfs            48G     0   48G   0% /sys/fs/cgroup
    /dev/sda1       823G   49G  733G   7% /etc/hosts
    shm              64M     0   64M   0% /dev/shm
    tmpfs            48G     0   48G   0% /sys/firmware
    [root@18ca8d8ced5b /]# exit
    exit
    iot@sgbu-ucs-11:/nobackup/docker$ WARN[0988] Couldn't run auplink before unmount /nobackup/docker/workspace1.13.1/aufs/mnt/f7babbdcde18ee51bc5efffbe67aff8edc734753624c91f0bfb8702ef4922d93: exec: "auplink": executable file not found in $PATH 
    
    iot@sgbu-ucs-11:/nobackup/docker$ sudo docker ps -a
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                         PORTS               NAMES
    18ca8d8ced5b        fedora              "/bin/bash"         5 minutes ago       Exited (0) 12 seconds ago                          romantic_einstein
    81b59ab256b3        hello-world         "/hello"            About an hour ago   Exited (0) About an hour ago                       keen_mestorf
    iot@sgbu-ucs-11:/nobackup/docker$ 
    There is another way to load docker image by reading a prepared and downloaded binary of docker image:
    iot@sgbu-ucs-11:/nobackup/docker$ sudo docker load --input widevine-api.tar 
    e7ebc6e16708: Loading layer [==================================================>] 133.8 MB/133.8 MB
    f934e33a54a6: Loading layer [==================================================>] 15.87 kB/15.87 kB
    bf6751561805: Loading layer [==================================================>] 11.78 kB/11.78 kB
    943edb549a83: Loading layer [==================================================>] 4.608 kB/4.608 kB
    c1bd37d01c89: Loading layer [==================================================>] 3.072 kB/3.072 kB
    a95df000892a: Loading layer [==================================================>] 31.23 kB/31.23 kB
    87a8db33c00a: Loading layer [==================================================>] 680.7 MB/680.7 MB
    3eb94c8c4801: Loading layer [==================================================>] 1.536 kB/1.536 kB
    ae09daac5f09: Loading layer [==================================================>] 10.37 MB/10.37 MB
    7515649c4f96: Loading layer [==================================================>] 34.23 MB/34.23 MB
    3df54ddc927e: Loading layer [==================================================>] 3.584 kB/3.584 kB
    afaa58df73a7: Loading layer [==================================================>] 3.584 kB/3.584 kB
    54f82330fe32: Loading layer [==================================================>] 4.608 kB/4.608 kB
    cce3f38770a6: Loading layer [==================================================>] 3.072 kB/3.072 kB
    f157603ca1b0: Loading layer [==================================================>] 2.048 kB/2.048 kB
    14f338761f7e: Loading layer [==================================================>] 2.048 kB/2.048 kB
    Loaded image: registry.axinom.com/widevine-api/app:latest
    iot@sgbu-ucs-11:/nobackup/docker$ sudo docker images
    REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
    nginx                                  latest              6b914bbcb89e        4 days ago          182 MB
    fedora                                 latest              1f8ec1108a3f        2 weeks ago         230 MB
    hello-world                            latest              48b5124b2768        7 weeks ago         1.84 kB
    registry.axinom.com/widevine-api/app   latest              a8c197b7a44b        3 months ago        840 MB
    iot@sgbu-ucs-11:/nobackup/docker$ iot@sgbu-ucs-11:/nobackup/docker$ sudo docker run registry.axinom.com/widevine-api/app -it
    WARN[1873] Couldn't run auplink before unmount /nobackup/docker/workspace1.13.1/aufs/mnt/f17847c68b04f64b687f745fb49abf82cde3fcb4ba38cbdb94748862e69c4d2b-init: exec: "auplink": executable file not found in $PATH 
    WARN[1873] Couldn't run auplink before unmount /nobackup/docker/workspace1.13.1/aufs/mnt/f17847c68b04f64b687f745fb49abf82cde3fcb4ba38cbdb94748862e69c4d2b: exec: "auplink": executable file not found in $PATH 
    INFO[1874] No non-localhost DNS nameservers are left in resolv.conf. Using default external servers: [nameserver 8.8.8.8 nameserver 8.8.4.4] 
    INFO[1874] IPv6 enabled; Adding default IPv6 external servers: [nameserver 2001:4860:4860::8888 nameserver 2001:4860:4860::8844] 
    The setup has been successfully completed.
    ..........
    # Reference For more details, check [docker docs](https://docs.docker.com/engine/installation/binaries/#install-daemon-and-client-binaries-on-linux).