How to install Docker on Oracle Linux

## How to install Docker on Oracle Linux

### update public-yum-ol7.repo (as needed)

```shell-session

# cd /etc/yum.repos.d/
# wget http://yum.oracle.com/public-yum-ol7.repo

```

### enable ol7_addons, ol7_UEKR4

```shell-session
# vi public-yum-ol7.repo

[ol7_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_UEKR4]
name=Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

[ol7_addons]
name=Oracle Linux $releasever Add ons ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

```

### yum install docker-engine

```shell-session

yum install docker-engine
Loaded plugins: langpacks, ulninfo
ol7_UEKR4                                                                                                                                                   506/506
ol7_addons                                                                                                                                                  251/251
ol7_developer                                                                                                                                               120/120
ol7_developer_EPEL                                                                                                                                      11788/11788
ol7_latest                                                                                                                                              23517/23517
ol7_optional_latest                                                                                                                                     16636/16636
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:17.06.2.ol-1.0.1.el7 will be installed
--> Processing Dependency: container-selinux >= 2.9 for package: docker-engine-17.06.2.ol-1.0.1.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.21-1.el7 will be installed
--> Processing Dependency: selinux-policy-targeted >= 3.13.1-39 for package: 2:container-selinux-2.21-1.el7.noarch
--> Processing Dependency: selinux-policy-base >= 3.13.1-39 for package: 2:container-selinux-2.21-1.el7.noarch
--> Running transaction check
---> Package selinux-policy-targeted.noarch 0:3.13.1-166.0.3.el7_4.7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================
 Package                                        Arch                          Version                                       Repository                         Size
====================================================================================================================================================================
Installing:
 docker-engine                                  x86_64                        17.06.2.ol-1.0.1.el7                          ol7_addons                         21 M
Installing for dependencies:
 container-selinux                              noarch                        2:2.21-1.el7                                  ol7_addons                         28 k
 selinux-policy-targeted                        noarch                        3.13.1-166.0.3.el7_4.7                        ol7_latest                        6.5 M

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

Total download size: 27 M
Installed size: 92 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): container-selinux-2.21-1.el7.noarch.rpm                                                                                               |  28 kB  00:00:00     
(2/3): selinux-policy-targeted-3.13.1-166.0.3.el7_4.7.noarch.rpm                                                                             | 6.5 MB  00:00:00     
(3/3): docker-engine-17.06.2.ol-1.0.1.el7.x86_64.rpm                                                                                         |  21 MB  00:00:01     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                24 MB/s |  27 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : selinux-policy-targeted-3.13.1-166.0.3.el7_4.7.noarch                                                                                      1/3 
  Installing : 2:container-selinux-2.21-1.el7.noarch                                                                                                      2/3 
setsebool:  SELinux is disabled.
  Installing : docker-engine-17.06.2.ol-1.0.1.el7.x86_64                                                                                                  3/3 
  Verifying  : docker-engine-17.06.2.ol-1.0.1.el7.x86_64                                                                                                  1/3 
  Verifying  : selinux-policy-targeted-3.13.1-166.0.3.el7_4.7.noarch                                                                                      2/3 
  Verifying  : 2:container-selinux-2.21-1.el7.noarch                                                                                                      3/3 

Installed:
  docker-engine.x86_64 0:17.06.2.ol-1.0.1.el7                                                                                                                       

Dependency Installed:
  container-selinux.noarch 2:2.21-1.el7                                   selinux-policy-targeted.noarch 0:3.13.1-166.0.3.el7_4.7                                  

Complete!

```

### run docker


```shell-session

# systemctl start docker

# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─docker-sysconfig.conf
   Active: active (running) since Tue 2017-12-12 13:18:29 JST; 4s ago
     Docs: https://docs.docker.com
 Main PID: 25498 (dockerd)
   Memory: 16.2M
   CGroup: /system.slice/docker.service
           ├─25498 /usr/bin/dockerd --selinux-enabled
           └─25504 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/do...

```


cf. Install Docker on Oracle Linux 7 https://blogs.oracle.com/hlsu/install-docker-on-oracle-linux-7