Simplest Steps to Install Docker and Docker Compose into (Ubuntu, CentOS, Oracle Linux) - NETSEC

Latest

Learning, Sharing, Creating

Cybersecurity Memo

Tuesday, March 17, 2020

Simplest Steps to Install Docker and Docker Compose into (Ubuntu, CentOS, Oracle Linux)

Docker is a new technology that allows development teams to build, manage, and secure apps anywhere. Docker is basically a container engine which uses the Linux Kernel features like namespaces and control groups to create containers on top of an operating system and automates application deployment on the container.

Here are my simplest steps to install Docker and Docker Compose into Ubuntu 18.04 and 16.04.




For Ubuntu, usually following three commands will get you both docker and docker-compose installed.
apt-get update
apt-get install docker
apt-get install docker-compose


Install Docker and Compose into Ubuntu 18.04


Just one command:
snap install docker

root@ubuntu18-04-1:~# snap install docker
docker 18.09.9 from Canonical✓ installed


It will also install docker-compose. If your Ubuntu 18.04 notifies you do not have snap, you can install it with following command:
apt install snap




root@ubuntu18-04-1:~# docker version
Client:
 Version:           18.09.9
 API version:       1.39
 Go version:        go1.13.4
 Git commit:        1752eb3
 Built:             Sat Nov 16 01:05:26 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.09.9
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.13.4
  Git commit:       9552f2b
  Built:            Sat Nov 16 01:07:48 2019
  OS/Arch:          linux/amd64
  Experimental:     false
root@ubuntu18-04-1:~# docker-compose version
docker-compose version 1.23.2, build unknown
docker-py version: 3.7.3
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
root@ubuntu18-04-1:~# 
root@ubuntu18-04-1:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete 
Digest: sha256:9572f7cdcee8591948c2963463447a53466950b3fc15a247fcad1917ca215a2f
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.
    (amd64)
 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 ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

root@ubuntu18-04-1:~# root@ubuntu18-04-1:~# docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        13 months ago       1.84kB
root@ubuntu18-04-1:~# 


Or, just issue following three commands:


sudo -i
yum -y update
curl -sSL https://get.docker.com/ | sh

Then execute the following command to install Docker CE:
$ sudo yum install docker-ce –y

Install Docker and Compose into Ubuntu 16.04

For Ubuntu 16.04, you will need six commands to install Docker:

sudo apt update sudo apt install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt update sudo apt -y install docker-ce


For Docker-Compose, you will either using following command to take it longer :
apt install docker-compose

Or you can use following two commands to get it done faster:

curl -L "https://github.com/docker/compose/releases/download/1.19.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose

You can test your first example docker hello-world with following command:
docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.



root@ubuntu16-04-1:~# docker --version
Docker version 18.09.9, build 1752eb3
root@ubuntu16-04-1:~# docker-compose --version
docker-compose version 1.23.2, build unknown
root@ubuntu16-04-1:~# 




For 18.04,


sudo apt-get update
sudo apt-get upgrade
sudo apt install docker.io
sudo apt install docker-ce
sudo systemctl start docker
sudo systemctl enable docker
sudo systemctl status docker
docker -v






Ubuntu Snap Command Usage Guide

root@ubuntu18-04-1:~# snap list
Name              Version    Rev   Tracking  Publisher          Notes
core              16-2.42.5  8268  stable    canonical✓         core
docker            18.09.9    423   stable    canonical✓         -
google-cloud-sdk  278.0.0    115   stable/…  google-cloud-sdk✓  classic
root@ubuntu18-04-1:~# snap refresh
google-cloud-sdk 279.0.0 from Cloud SDK (google-cloud-sdk✓) refreshed
root@ubuntu18-04-1:~# 
root@ubuntu18-04-1:~# snap find nextcloud
Name                       Version                    Publisher         Notes  Summary
nextcloud                  16.0.7snap2                nextcloud✓        -      Nextcloud Server - A safe home for all your data
spreedme                   0.29.5snap1                nextcloud✓        -      Spreed.ME audio/video calls and conferences feature for the Nextcloud Snap
qownnotes                  20.2.2                     pbek              -      Plain-text file markdown note taking with Nextcloud / ownCloud integration
onlyoffice-desktopeditors  5.4.1                      onlyoffice✓       -      A comprehensive office suite for editing documents, spreadsheets and presentations
nextcloud-port8080         1.01                       arcticslyfox      -      Nextcloud Server
nextcloud-snap-abacao      11.0.3snap4                abacao            -      Nextcloud Server
nextcloud-nextant          11.0.0snap3                rmescandon        -      Nextcloud Server + search support
nextcloud-abacao           11.0.3snap4                abacao            -      Nextcloud Server
cashbox-nextcloud          11.0.2snap2                cashbox           -      Nextcloud Server for www.cashBOX.plus
nextcloudsnap              12.0.4snap1                oscarbrolin       -      Nextcloud Server - A safe home for all your data
ghostcloud                 0.9.5                      beidl             -      A modern cross-platform client for Nextcloud, ownCloud, WebDav.
htxucloud                  12.0.3snap7                htxu              -      Nextcloud Server
carnet                     0.18.7                     alexandre-roux-m  -      Powerful note taking app with sync, online editor and android app
opentodolist               3.18.0                     mhoeher           -      Todo list and note taking application
solr                       0.1                        rmescandon        -      Starts up solr as forking daemon
mdns-hostname              0.0.1                      welike            -      mDNS mini-daemon to published hostname.local
nextcloud-stondino         15.0.10snap3+git1.ff25cb9  zmusselman        -      Nextcloud Server - A safe home for all your data
vmcloud-nextcloud          1.0.0                      victoriususm      -      Nextcloud 16.0.3 Optimized-Boosted
feedreader                 0+git.9ac478f7             ken-vandine       -      RSS client for various webservices
test003-nc                 13.0.4.snap1               reinism           -      Nextcloud Server - A safe home for all your data
root@ubuntu18-04-1:~# snap remove hello-world


Install Docker and Compose CentOS7

Method 1:
sudo -i
yum update
yum upgrade
yum install docker
systemctl enable docker
systemctl start docker


////latest docker-compose stable version is 1.25.4. Check https://docs.docker.com/compose/install/ to get the latest stable version.


curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version


[root@shadowdaemon1 ~]# yum upgrade
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
No packages marked for update
[root@shadowdaemon1 ~]# yum install docker
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 2:1.13.1-109.gitcccb291.el7.centos will be installed
--> Processing Dependency: docker-common = 2:1.13.1-109.gitcccb291.el7.centos for package: 2:docker-1.13.1-109.gitcccb291.el7.centos.x86_64
--> Processing Dependency: docker-client = 2:1.13.1-109.gitcccb291.el7.centos for package: 2:docker-1.13.1-109.gitcccb291.el7.centos.x86_64
--> Processing Dependency: subscription-manager-rhsm-certificates for package: 2:docker-1.13.1-109.gitcccb291.el7.centos.x86_64
--> Running transaction check
---> Package docker-client.x86_64 2:1.13.1-109.gitcccb291.el7.centos will be installed
---> Package docker-common.x86_64 2:1.13.1-109.gitcccb291.el7.centos will be installed
--> Processing Dependency: skopeo-containers >= 1:0.1.26-2 for package: 2:docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64
--> Processing Dependency: oci-umount >= 2:2.3.3-3 for package: 2:docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64
--> Processing Dependency: oci-systemd-hook >= 1:0.1.4-9 for package: 2:docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64
--> Processing Dependency: oci-register-machine >= 1:0-5.13 for package: 2:docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64
--> Processing Dependency: container-storage-setup >= 0.9.0-1 for package: 2:docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64
--> Processing Dependency: container-selinux >= 2:2.51-1 for package: 2:docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64
--> Processing Dependency: atomic-registries for package: 2:docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64
---> Package subscription-manager-rhsm-certificates.x86_64 0:1.24.13-3.el7.centos will be installed
--> Running transaction check
---> Package atomic-registries.x86_64 1:1.22.1-29.gitb507039.el7 will be installed
--> Processing Dependency: python-setuptools for package: 1:atomic-registries-1.22.1-29.gitb507039.el7.x86_64
--> Processing Dependency: python-pytoml for package: 1:atomic-registries-1.22.1-29.gitb507039.el7.x86_64
---> Package container-selinux.noarch 2:2.107-3.el7 will be installed
--> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.107-3.el7.noarch
---> Package container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7 will be installed
---> Package containers-common.x86_64 1:0.1.37-3.el7.centos will be installed
---> Package oci-register-machine.x86_64 1:0-6.git2b44233.el7 will be installed
---> Package oci-systemd-hook.x86_64 1:0.2.0-1.git05e6923.el7_6 will be installed
---> Package oci-umount.x86_64 2:2.5-3.el7 will be installed
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.5-33.el7 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libcgroup for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-33.el7.x86_64
---> Package python-pytoml.noarch 0:0.1.14-1.git7dea353.el7 will be installed
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.5-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================================================================================
 Package                                                                           Arch                                              Version                                                                         Repository                                          Size
==============================================================================================================================================================================================================================================================================
Installing:
 docker                                                                            x86_64                                            2:1.13.1-109.gitcccb291.el7.centos                                              extras                                              18 M
Installing for dependencies:
 atomic-registries                                                                 x86_64                                            1:1.22.1-29.gitb507039.el7                                                      extras                                              35 k
 audit-libs-python                                                                 x86_64                                            2.8.5-4.el7                                                                     base                                                76 k
 checkpolicy                                                                       x86_64                                            2.5-8.el7                                                                       base                                               295 k
 container-selinux                                                                 noarch                                            2:2.107-3.el7                                                                   extras                                              39 k
 container-storage-setup                                                           noarch                                            0.11.0-2.git5eaf76c.el7                                                         extras                                              35 k
 containers-common                                                                 x86_64                                            1:0.1.37-3.el7.centos                                                           extras                                              21 k
 docker-client                                                                     x86_64                                            2:1.13.1-109.gitcccb291.el7.centos                                              extras                                             3.9 M
 docker-common                                                                     x86_64                                            2:1.13.1-109.gitcccb291.el7.centos                                              extras                                              98 k
 libcgroup                                                                         x86_64                                            0.41-21.el7                                                                     base                                                66 k
 libsemanage-python                                                                x86_64                                            2.5-14.el7                                                                      base                                               113 k
 oci-register-machine                                                              x86_64                                            1:0-6.git2b44233.el7                                                            extras                                             1.1 M
 oci-systemd-hook                                                                  x86_64                                            1:0.2.0-1.git05e6923.el7_6                                                      extras                                              34 k
 oci-umount                                                                        x86_64                                            2:2.5-3.el7                                                                     extras                                              33 k
 policycoreutils-python                                                            x86_64                                            2.5-33.el7                                                                      base                                               457 k
 python-IPy                                                                        noarch                                            0.75-6.el7                                                                      base                                                32 k
 python-backports                                                                  x86_64                                            1.0-8.el7                                                                       base                                               5.8 k
 python-backports-ssl_match_hostname                                               noarch                                            3.5.0.1-1.el7                                                                   base                                                13 k
 python-ipaddress                                                                  noarch                                            1.0.16-2.el7                                                                    base                                                34 k
 python-pytoml                                                                     noarch                                            0.1.14-1.git7dea353.el7                                                         extras                                              18 k
 python-setuptools                                                                 noarch                                            0.9.8-7.el7                                                                     base                                               397 k
 setools-libs                                                                      x86_64                                            3.3.8-4.el7                                                                     base                                               620 k
 subscription-manager-rhsm-certificates                                            x86_64                                            1.24.13-3.el7.centos                                                            updates                                            228 k

Transaction Summary
==============================================================================================================================================================================================================================================================================
Install  1 Package (+22 Dependent packages)

Total download size: 25 M
Installed size: 88 M
Is this ok [y/d/N]: y
Downloading packages:
(1/23): audit-libs-python-2.8.5-4.el7.x86_64.rpm                                                                                                                                                                                                       |  76 kB  00:00:00     
(2/23): container-selinux-2.107-3.el7.noarch.rpm                                                                                                                                                                                                       |  39 kB  00:00:00     
(3/23): checkpolicy-2.5-8.el7.x86_64.rpm                                                                                                                                                                                                               | 295 kB  00:00:00     
(4/23): atomic-registries-1.22.1-29.gitb507039.el7.x86_64.rpm                                                                                                                                                                                          |  35 kB  00:00:01     
(5/23): container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch.rpm                                                                                                                                                                                     |  35 kB  00:00:00     
(6/23): containers-common-0.1.37-3.el7.centos.x86_64.rpm                                                                                                                                                                                               |  21 kB  00:00:00     
(7/23): docker-client-1.13.1-109.gitcccb291.el7.centos.x86_64.rpm                                                                                                                                                                                      | 3.9 MB  00:00:01     
(8/23): docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64.rpm                                                                                                                                                                                      |  98 kB  00:00:00     
(9/23): libcgroup-0.41-21.el7.x86_64.rpm                                                                                                                                                                                                               |  66 kB  00:00:00     
(10/23): libsemanage-python-2.5-14.el7.x86_64.rpm                                                                                                                                                                                                      | 113 kB  00:00:00     
(11/23): oci-register-machine-0-6.git2b44233.el7.x86_64.rpm                                                                                                                                                                                            | 1.1 MB  00:00:00     
(12/23): oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64.rpm                                                                                                                                                                                          |  34 kB  00:00:00     
(13/23): oci-umount-2.5-3.el7.x86_64.rpm                                                                                                                                                                                                               |  33 kB  00:00:00     
(14/23): python-IPy-0.75-6.el7.noarch.rpm                                                                                                                                                                                                              |  32 kB  00:00:00     
(15/23): python-backports-1.0-8.el7.x86_64.rpm                                                                                                                                                                                                         | 5.8 kB  00:00:00     
(16/23): python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm                                                                                                                                                                                  |  13 kB  00:00:00     
(17/23): policycoreutils-python-2.5-33.el7.x86_64.rpm                                                                                                                                                                                                  | 457 kB  00:00:00     
(18/23): python-ipaddress-1.0.16-2.el7.noarch.rpm                                                                                                                                                                                                      |  34 kB  00:00:00     
(19/23): python-setuptools-0.9.8-7.el7.noarch.rpm                                                                                                                                                                                                      | 397 kB  00:00:00     
(20/23): setools-libs-3.3.8-4.el7.x86_64.rpm                                                                                                                                                                                                           | 620 kB  00:00:00     
(21/23): docker-1.13.1-109.gitcccb291.el7.centos.x86_64.rpm                                                                                                                                                                                            |  18 MB  00:00:02     
(22/23): python-pytoml-0.1.14-1.git7dea353.el7.noarch.rpm                                                                                                                                                                                              |  18 kB  00:00:00     
(23/23): subscription-manager-rhsm-certificates-1.24.13-3.el7.centos.x86_64.rpm                                                                                                                                                                        | 228 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                         5.4 MB/s |  25 MB  00:00:04     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libcgroup-0.41-21.el7.x86_64                                                                                                                                                                                                                              1/23 
  Installing : subscription-manager-rhsm-certificates-1.24.13-3.el7.centos.x86_64                                                                                                                                                                                        2/23 
  Installing : python-ipaddress-1.0.16-2.el7.noarch                                                                                                                                                                                                                      3/23 
  Installing : audit-libs-python-2.8.5-4.el7.x86_64                                                                                                                                                                                                                      4/23 
  Installing : python-backports-1.0-8.el7.x86_64                                                                                                                                                                                                                         5/23 
  Installing : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch                                                                                                                                                                                                  6/23 
  Installing : python-setuptools-0.9.8-7.el7.noarch                                                                                                                                                                                                                      7/23 
  Installing : 1:oci-register-machine-0-6.git2b44233.el7.x86_64                                                                                                                                                                                                          8/23 
  Installing : 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64                                                                                                                                                                                                        9/23 
  Installing : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                                                                                                     10/23 
  Installing : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                                                                                          11/23 
  Installing : python-pytoml-0.1.14-1.git7dea353.el7.noarch                                                                                                                                                                                                             12/23 
  Installing : 1:atomic-registries-1.22.1-29.gitb507039.el7.x86_64                                                                                                                                                                                                      13/23 
  Installing : python-IPy-0.75-6.el7.noarch                                                                                                                                                                                                                             14/23 
  Installing : 1:containers-common-0.1.37-3.el7.centos.x86_64                                                                                                                                                                                                           15/23 
  Installing : 2:oci-umount-2.5-3.el7.x86_64                                                                                                                                                                                                                            16/23 
  Installing : checkpolicy-2.5-8.el7.x86_64                                                                                                                                                                                                                             17/23 
  Installing : policycoreutils-python-2.5-33.el7.x86_64                                                                                                                                                                                                                 18/23 
  Installing : 2:container-selinux-2.107-3.el7.noarch                                                                                                                                                                                                                   19/23 
  Installing : container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch                                                                                                                                                                                                   20/23 
  Installing : 2:docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64                                                                                                                                                                                                  21/23 
  Installing : 2:docker-client-1.13.1-109.gitcccb291.el7.centos.x86_64                                                                                                                                                                                                  22/23 
  Installing : 2:docker-1.13.1-109.gitcccb291.el7.centos.x86_64                                                                                                                                                                                                         23/23 
  Verifying  : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch                                                                                                                                                                                                  1/23 
  Verifying  : 2:container-selinux-2.107-3.el7.noarch                                                                                                                                                                                                                    2/23 
  Verifying  : container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch                                                                                                                                                                                                    3/23 
  Verifying  : 1:atomic-registries-1.22.1-29.gitb507039.el7.x86_64                                                                                                                                                                                                       4/23 
  Verifying  : python-setuptools-0.9.8-7.el7.noarch                                                                                                                                                                                                                      5/23 
  Verifying  : 2:docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64                                                                                                                                                                                                   6/23 
  Verifying  : 2:docker-1.13.1-109.gitcccb291.el7.centos.x86_64                                                                                                                                                                                                          7/23 
  Verifying  : checkpolicy-2.5-8.el7.x86_64                                                                                                                                                                                                                              8/23 
  Verifying  : 2:oci-umount-2.5-3.el7.x86_64                                                                                                                                                                                                                             9/23 
  Verifying  : 1:containers-common-0.1.37-3.el7.centos.x86_64                                                                                                                                                                                                           10/23 
  Verifying  : python-IPy-0.75-6.el7.noarch                                                                                                                                                                                                                             11/23 
  Verifying  : 2:docker-client-1.13.1-109.gitcccb291.el7.centos.x86_64                                                                                                                                                                                                  12/23 
  Verifying  : python-pytoml-0.1.14-1.git7dea353.el7.noarch                                                                                                                                                                                                             13/23 
  Verifying  : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                                                                                          14/23 
  Verifying  : policycoreutils-python-2.5-33.el7.x86_64                                                                                                                                                                                                                 15/23 
  Verifying  : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                                                                                                     16/23 
  Verifying  : 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64                                                                                                                                                                                                       17/23 
  Verifying  : 1:oci-register-machine-0-6.git2b44233.el7.x86_64                                                                                                                                                                                                         18/23 
  Verifying  : python-backports-1.0-8.el7.x86_64                                                                                                                                                                                                                        19/23 
  Verifying  : audit-libs-python-2.8.5-4.el7.x86_64                                                                                                                                                                                                                     20/23 
  Verifying  : python-ipaddress-1.0.16-2.el7.noarch                                                                                                                                                                                                                     21/23 
  Verifying  : subscription-manager-rhsm-certificates-1.24.13-3.el7.centos.x86_64                                                                                                                                                                                       22/23 
  Verifying  : libcgroup-0.41-21.el7.x86_64                                                                                                                                                                                                                             23/23 

Installed:
  docker.x86_64 2:1.13.1-109.gitcccb291.el7.centos                                                                                                                                                                                                                            

Dependency Installed:
  atomic-registries.x86_64 1:1.22.1-29.gitb507039.el7               audit-libs-python.x86_64 0:2.8.5-4.el7                                      checkpolicy.x86_64 0:2.5-8.el7                                 container-selinux.noarch 2:2.107-3.el7                        
  container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7          containers-common.x86_64 1:0.1.37-3.el7.centos                              docker-client.x86_64 2:1.13.1-109.gitcccb291.el7.centos        docker-common.x86_64 2:1.13.1-109.gitcccb291.el7.centos       
  libcgroup.x86_64 0:0.41-21.el7                                    libsemanage-python.x86_64 0:2.5-14.el7                                      oci-register-machine.x86_64 1:0-6.git2b44233.el7               oci-systemd-hook.x86_64 1:0.2.0-1.git05e6923.el7_6            
  oci-umount.x86_64 2:2.5-3.el7                                     policycoreutils-python.x86_64 0:2.5-33.el7                                  python-IPy.noarch 0:0.75-6.el7                                 python-backports.x86_64 0:1.0-8.el7                           
  python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7        python-ipaddress.noarch 0:1.0.16-2.el7                                      python-pytoml.noarch 0:0.1.14-1.git7dea353.el7                 python-setuptools.noarch 0:0.9.8-7.el7                        
  setools-libs.x86_64 0:3.3.8-4.el7                                 subscription-manager-rhsm-certificates.x86_64 0:1.24.13-3.el7.centos       

Complete!
[root@shadowdaemon1 ~]# yum install docker-compose
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
No package docker-compose available.
Error: Nothing to do
[root@shadowdaemon1 ~]# curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   617  100   617    0     0   3960      0 --:--:-- --:--:-- --:--:--  3980
100 15.4M  100 15.4M    0     0  33.1M      0 --:--:-- --:--:-- --:--:--  216M
[root@shadowdaemon1 ~]# sudo chmod +x /usr/local/bin/docker-compose
[root@shadowdaemon1 ~]# ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
[root@shadowdaemon1 ~]# docker-compose --version
docker-compose version 1.24.1, build 4667896b







Method 2:

Step 1 — Install Docker

Install needed packages:
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Configure the docker-ce repo:
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install docker-ce:
$ sudo yum install docker-ce
Add your user to the docker group with the following command.
$ sudo usermod -aG docker $(whoami)
Set Docker to start automatically at boot time:
$ sudo systemctl enable docker.service
Finally, start the Docker service:
$ sudo systemctl start docker.service

Step 2 — Install Docker Compose

Install Extra Packages for Enterprise Linux
$ sudo yum install epel-release
Install python-pip
$ sudo yum install -y python-pip
Then install Docker Compose:
$ sudo pip install docker-compose
You will also need to upgrade your Python packages on CentOS 7 to get docker-compose to run successfully:
$ sudo yum upgrade python*
To verify a successful Docker Compose installation, run:
$ docker-compose version




Install Docker and Compose into Oracle Linux 7.7


Docker and Git are required for the subsuquent labs. You will install the Docker engine, enable it to start on re-boot, grant docker privledges to the opc user and finally install Git.
  • The sudo -s command brings you to the root context, where you can run commands as a "super-user" and gain more administrative privileges. Once you have SSH'd into the compute instance and see something along the lines of [opc@dockertest ~]$, run the following commands:
  sudo -s
  yum install docker-engine
During the yum install docker-engine command press Y is asked if installation is ok. Then run these commands:
  usermod -aG docker opc
  systemctl enable docker
  systemctl start docker
  • Run the following command to install git:
  •   yum install git
  • The su - opc command brings you to a new context identical to that of the original opc user context upon successfully SSH'ing into the compute instance. Run the following commands to verify good installations:
  •   su - opc
      docker version
      docker images
      git --version




References

No comments:

Post a Comment