This article gives a step-by-step guide to install docker on Linux 6.x.
Prerequisites
Linux machine or VM should have Oracle Linux 6
check your system Expand source
Run as root user:
/usr/local/packages/aime/emdw/run_as_root su
Change /etc/yum.conf by adding :
proxy=http:
//www-proxy.us.oracle.com:80
Set the following proxy variables:
export http_proxy=http:
//www-proxy.us.oracle.com:80
export https_proxy=http:
//www-proxy.us.oracle.com:80
export HTTP_PROXY=http:
//www-proxy.us.oracle.com:80
export HTTPS_PROXY=http:
//www-proxy.us.oracle.com:80
export no_proxy=localhost,
127.0
.
0.1
,*.oracle.com,*.oraclecorp.com
Check if /etc/yum.repos.d/public-yum-ol6.repo exists:
- If Yes
-
vi public-yum-ol6.repo
- Enable ol6_UEKR4 (enable=1)
- Disable anything else (enable=0)
-
- If No
-
run the following command to download public-yum-ol6.repo:
curl -o
public
-yum-ol6.repo http:
//public-yum.oracle.com/public-yum-ol6.repo
- Do as above.
-
Upgrade kernel
Since docker requireskenerl4.x and now our image is on 3.8.x, we need to update kernal by running:
yum -y upgrade kernal*
update Kernal Expand source
In my case, when I run yum -y upgrade kernal*, it gives the following error message:
update error message Expand source
Thus I use yum -y upgrade kernal* --skip-broken instead, and the issue is gone.
Reboot your machine to take the upgrade into effect:
/sbin/shutdown -r now
This process will probably take more than 4 hrs. Just wait the machine come back.
You can check kernal by running uname -a, and you will find kernal has been upgrated to 4.x.
In my case, it fails to upgrade kernal firstly due to unknown reason although the log indicates upgrate is complete.
I just re-run yum -y upgrade kernal* --skip-broken and reboot again. It works then.
change public-yum-ol6.repo:
vi /etc/yum.repos.d/public-yum-ol6.repo
-
enable ol6_addons
-
enable ol6_latest
-
disable anything else
Install Docker Engine
yum
install
-y docker-engine
Configure Docker
Step 1:
- vi /etc/sysconfig/docker
-
replace other_args='' with the following content:
other_args=
'-b=oradocker0 -g /scratch/docker --group=docker --storage-driver=overlay --storage-opt dm.basesize=60g --insecure-registry ossa.docker.oraclecorp.com --insecure-registry oscf.docker.oraclecorp.com --insecure-registry faxarch.docker.oraclecorp.com'
DOCKER_CERT_PATH=
/etc/docker
export
HTTP_PROXY=
"http://www-proxy.us.oracle.com:80"
export
HTTPS_PROXY=
"http://www-proxy.us.oracle.com:80"
export
NO_PROXY=
"localhost,127.0.0.1,.us.oracle.com,.oraclecorp.com"
umask
022
-
Docker images will be located at /scratch/docker (-g option)
- Maximum image size up from 10Gb to 60 GB (--storage-opt dm.basesize=60g, I still set it as 10g)
-
Images can be pulled from Artifactory faxarch: --insecure-registry faxarch.docker.oraclecorp.com
-
Step 2:
- vi /etc/init.d/docker # autofs bug
-
change the line
"$unshare"
-m -- $
exec
$other_args >> $logfile 2>&1 &
-
to
$
exec
$other_args >> $logfile 2>&1 &
Step 3:
- Configure Network: (due to SLC OpenStack images, do this on all to keep consistent)
-
run the following command to create a new file:
vi /etc/sysconfig/network-scripts/ifcfg-oradocker0
-
add the following lines to the above file:
DEVICE=oradocker0
BOOTPROTO=none
IPADDR=172.18.0.1
NETMASK=255.255.0.0
ONBOOT=
yes
TYPE=Bridge
NM_CONTROLLED=no
DELAY=0
Step 4: start docker
- /sbin/chkconfig docker on
- sudo /sbin/ifconfig docker0 down (may say it does not exist, so ignore)
-
sudo /sbin/service network restart
[root@slc05ibr 1.0]
# sudo /sbin/service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Determining
if
ip address 10.245.225.119 is already
in
use
for
device eth0...
[ OK ]
Bringing up interface oradocker0: Determining
if
ip address 172.18.0.1 is already
in
use
for
device oradocker0...
[ OK ]
-
/sbin/service docker start
[root@slc05ibr lib]
# /sbin/service docker start
Starting docker: . [ OK ]
-
/usr/sbin/usermod -a -G docker <username_who_wants_to_run_docker_cmds>
[root@slc05ibr imagedb]
# /usr/sbin/usermod -a -G docker <name>
usermod
: group
'docker'
does not exist
[root@slc05ibr imagedb]
# /usr/sbin/groupadd docker
[root@slc05ibr imagedb]
# /usr/sbin/usermod -a -G docker <name>
[root@slc05ibr imagedb]
#
-
/sbin/service docker status
[root@slc05ibr 1.0]
# /sbin/service docker status
docker (pid 26523) is running...
Step 5: docker test
-
docker run hello-world
[root@slc05ibr ~]
# docker run hello-world
Unable to
find
image
'hello-world:latest'
locally
latest: Pulling from library
/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:97ce6fa4b6cdc0790cda65fe7290b74cfebd9fa0c9b8c38e979330d547d22ce1
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:
//cloud
.docker.com/
For
more
examples and ideas, visit:
https:
//docs
.docker.com
/engine/userguide/
Issues & Solutions
# |
Issue |
Solutions |
---|---|---|
# |
Issue |
Solutions |
1 | Cannot connect to the Docker daemon. Is 'docker -d' running on this host? | Run: docker version If there is the same problem: Just reboot VM. check if docker is running, if not start docker. If yes, try as ROOT user. |
2 | You do not have enough privileges to perform this operation. |
Run as root user: /usr/local/packages/aime/emdw/run_as_root su |
3 |
Docker status: docker dead but subsys locked |
|
4 | ||
5 |