Skip to content

Instantly share code, notes, and snippets.

@oko
Created February 19, 2016 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oko/8786b15fbf71d4556ff9 to your computer and use it in GitHub Desktop.
Save oko/8786b15fbf71d4556ff9 to your computer and use it in GitHub Desktop.
Install Docker Engine on CentOS 7 and configure with docker-storage thin pool
#!/bin/bash
THINPOOL=$1
yum -y install docker-engine
if [ ! -L $THINPOOL ]; then
echo "Pool $THINPOOL" does not appear to exist
exit 1
fi
mkdir -p /etc/systemd/system/docker.service.d
cat <<-'EOF' > /etc/systemd/system/docker.service.d/centos.conf
[Service]
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// $OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$BLOCK_REGISTRY \
$INSECURE_REGISTRY
EOF
cat <<-EOF > /etc/sysconfig/docker-storage
DOCKER_STORAGE_OPTIONS=" --storage-driver=devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=$THINPOOL"
EOF
systemctl daemon-reload
systemctl enable docker
systemctl start docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment