Created
February 19, 2016 14:34
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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