RHEL 7 Installation
Prerequisites
- Ask sysadmin to get 100G SAN added to the host, and add it as a volume group in lvm. (Mounting is not needed)
- Also note that / on rhel 7.2 image is too little, Sysadmin should provision with bigger /.
- Go to Docker Installation page for the latest versions of rpm/deb and install process.
- For our initial installation we are focusing on RHEL7.1 install which can be found here: https://docs.docker.com/engine/installation/linux/rhel/
Setting up storage for docker
-
Set up thinpool storage for the docker & /data for the local storage. The volume group is named vgsan. The volume for /data is named lvdata. The thin pool is named cr8-thinpool.
[root@r system]
# lvm
# scan volume groups
lvm> vgs
VG
#PV #LV #SN Attr VSize VFree
vgsan 1 2 0 wz--n- 100.00g 3.00g
# create a 20G /data volume
lvm> lvcreate -L 20G -n lvdata vgsan
WARNING: ext4 signature detected on
/dev/vgsan/lvdata
at offset 1080. Wipe it? [y
/n
]: y
Wiping ext4 signature on
/dev/vgsan/lvdata
.
Logical volume
"lvdata"
created.
# create logical volumes for 75G thinpool & 1G metadata (2 steps)
lvm> lvcreate --wipesignatures y -L 75G -n cr8-thinpool vgsan
lvm> lvcreate --wipesignatures y -L 1G -n cr8-thinpoolmeta vgsan
# convert cr8-thinpool in to a pool
lvm> lvconvert -y --zero n -c 512K --thinpool vgsan
/cr8-thinpool
--poolmetadata vgsan
/cr8-thinpoolmeta
WARNING: Converting logical volume vgsan
/cr8-thinpool
and vgsan
/cr8-thinpoolmeta
to pool's data and metadata volumes.
THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
Converted vgsan
/cr8-thinpool
to thin pool.
# scan logical volumes
lvm> lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
cr8-thinpool vgsan twi-a-t--- 75.00g 0.00 0.01
lvdata vgsan -wi-a----- 20.00g
-
Create ext4 filesystem on /dev/vgsan/lvdata and mount as /data
[root
@
lib]# mkfs.ext4 /dev/vgsan/lvdata
mke2fs
1.42
.
9
(
28
-Dec-
2013
)
Writing superblocks and filesystem accounting information: done
[root
@r
lib]# mkdir /data
[root
@r
lib]# vim /etc/fstab
...
/dev/vgsan/lvdata /data ext4 defaults
1
2
...
[root
@r
]# mount /data
-
Now create LVM thinpool profile for & activate the cr8-thinpool
[root@r
~]
# vim /etc/lvm/profile/vgsan-cr8-thinpool.profile
activation {
thin_pool_autoextend_threshold=80
thin_pool_autoextend_percent=20
}
[root@rtp
-wadl
-dsbld
/]
# lvchange --metadataprofile vgsan-cr8-thinpool vgsan/cr8-thinpool
Logical volume
"cr8-thinpool"
changed.
Install docker using yum
-
Log into your machine as a user with
sudo
orroot
privileges. -
Enable updates with yum.
yum-config-manager --enable
"*pdates"
-
Add the docker yum repo yourself.
echo "[dockerrepo]
name=Docker Repository
baseurl=https:
//yum.dockerproject.org/repo/main/centos/7
enabled=
1
gpgcheck=
1
gpgkey=https:
//yum.dockerproject.org/gpg" > /etc/yum.repos.d/docker.repo
-
Install the Docker package and disable updates
yum install docker-engine
yum-config-manager --disable
"*pdates"
-
Before starting docker, configure it to use the thinpool storage. Add these lines to /etc/docker/daemon.json. The dm.thinpool device is /dev/mapper/vgsan-cr8--thinpool (device mapper escapes - with --)
1234567891011121314151617181920{
"storage-driver"
:
"devicemapper"
,
"storage-opts"
: [
"dm.thinpooldev=/dev/mapper/vgsan-cr8--thinpool"
,
"dm.use_deferred_removal=true"
],
"cluster-store"
:
""
,
"cluster-store-opts"
: {},
"cluster-advertise"
:
""
,
"max-concurrent-downloads"
: 3,
"max-concurrent-uploads"
: 5,
"debug"
:
false
,
"hosts"
: [
"unix:///var/run/docker.sock"
,
"tcp://127.0.0.1:2376"
],
"group"
:
"docker-squad-devops"
,
"ip"
:
"0.0.0.0"
,
"bip"
:
"10.0.16.1/20"
,
"fixed-cidr"
:
"10.0.16.0/20"
}
-
Enable docker daemon & start the service
Expected output[root
@
/]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root
@rt
/]# systemctl daemon-reload
[root
@rt
/]# systemctl start docker
[root
@rt
~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Thu
2016
-
09
-
08
20
:
39
:
41
GMT; 6s ago
Docs: https:
//docs.docker.com
Main PID:
17086
(dockerd)
Memory:
15
.9M
CGroup: /system.slice/docker.service
├─
17086
/usr/bin/dockerd
└─
17092
docker-containerd -l unix:
///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc
-
Inspect docker info to ensure correct storage driver is being used
[root
@r
~]# docker info | grep -i pool
Pool Name: vgsan-cr8--thinpool
Pool Blocksize:
524.3
kB
Thin Pool Minimum Free Space:
8.053
GB
Troubleshooting installs on RHEL.
-
Stopping all containers & remove all images
docker kill $(docker ps -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
-
Unistall rpms
[root
@rt
/]# yum remove -y docker-engine
# check
if
docker rpms
[root
@r
/]# rpm -qa | grep docker
-
On Centos/RHEL docker uses device mapper based sparse file, these are basically all loop mounted (clean them). You can inspect all block devices using lsblk. The devicemapper ones can be removed using dmsetup
[root
@r
/]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0
2
:
0
1
4K
0
disk
sda
8
:
0
0
10G
0
disk
└─sda1
8
:
1
0
10G
0
part /
sdb
8
:
16
0
100G
0
disk
└─vgsan-lvdata
253
:
0
0
100G
0
lvm
sr0
11
:
0
1
1024M
0
rom
loop0
7
:
0
0
100G
0
loop
└─docker-
253
:
0
-
2490381
-pool
253
:
1
0
100G
0
dm
└─docker-
253
:
0
-
2490381
-0f32d2483af9599e707e6aedcf46dab133a976005a81a20706d81980fc32dec2
253
:
3
0
10G
0
dm
activation {
loop1
7
:
1
0
2G
0
loop
└─docker-
253
:
0
-
2490381
-pool
253
:
1
0
100G
0
dm
└─docker-
253
:
0
-
2490381
-0f32d2483af9599e707e6aedcf46dab133a976005a81a20706d81980fc32dec2
253
:
3
0
10G
0
dm
# umount & delete em
[root
@
/]#
for
dm in /dev/mapper/docker-*;
do
umount $dm; dmsetup remove $dm; done
umount: /dev/mapper/docker-
253
:
0
-
2490381
-0f32d2483af9599e707e6aedcf46dab133a976005a81a20706d81980fc32dec2: not mounted
umount: /dev/mapper/docker-
253
:
0
-
2490381
-pool: not mounted
-
Docker startup using systemd. Check that you are not passing any commandline args. Since we are using daemon.json now.
[root
@
/]# vim /usr/lib/systemd/system/docker.service
[root
/]# ls -l /etc/systemd/system/docker.service.d/*
Ubuntu Installation
Up to date installation instructions can be found on the Docker website here: https://docs.docker.com/engine/installation/linux/ubuntulinux/
This installation method worked for Ubuntu Trusty 14.04
- Login with sudo and root access to the Ubuntu installation target.
-
Verify the version of Ubuntu that you're installing on and also ensure the kernel version is at least 3.10+
# Check version of ubuntu
lsb_release -a
# Check kernel version
uname -r
- Edit the
/etc/apt/sources.list.d/docker.list
and add the correct information for the version of Ubuntu you're installing on and add the following respective entries to that file-
On Ubuntu Precise 12.04 (LTS)
deb https://apt.dockerproject.org/repo ubuntu-precise main
-
On Ubuntu Trusty 14.04 (LTS)
deb https://apt.dockerproject.org/repo ubuntu-trusty main
-
Ubuntu Wily 15.10
deb https://apt.dockerproject.org/repo ubuntu-wily main
-
-
Run another update after adding the above package repositories
apt-get update
-
Install docker
apt-get install docker-engine
-
Ensure docker daemon is started
service docker start
-
Verify docker is started correctly by running the hello world container
docker run hello-world