Skip to content

Instantly share code, notes, and snippets.

@jdye64
Last active August 16, 2018 23:51
Show Gist options
  • Save jdye64/d04d09f35bd20ae8cd38ef944ce140ca to your computer and use it in GitHub Desktop.
Save jdye64/d04d09f35bd20ae8cd38ef944ce140ca to your computer and use it in GitHub Desktop.
Script for installing Docker Engine, Compose, and Swarm on RHEL 7.2
#!/bin/bash
#### CHANGE DOCKER ROOT DIRECTORY ####
# For Azure VM edit vi /lib/systemd/system/docker.service to add the -g flag to the directory that you want be the Docker root directory
# systemctl daemon-reload
# systemctl restart docker
#### REDHAT 7 STOPPING FIREWALLD ####
# service firewalld stop
# systemctl disable firewalld
# One Liner for running this script is ....
# wget -O - https://gist.githubusercontent.com/jdye64/d04d09f35bd20ae8cd38ef944ce140ca/raw/d2e4c703116b2d039fcc8834f1b6ad43db81febd/DockerRHEL7Install.sh | sudo bash
sudo yum update -y
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
sudo yum install -y docker-engine
sudo systemctl enable docker.service
sudo systemctl start docker
sudo groupadd docker
sudo usermod -aG docker jeremy
sudo usermod -aG docker centos
sudo systemctl enable docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.12.0/docker-compose-$(uname -s)-$(uname -m)" > /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# place docker-compose on the PATH
echo -e "\n\nPATH=$PATH:/usr/local/bin\nexport PATH" >> ~/.bash_profile
source ~/.bash_profile
docker-compose --version
mkdir -p /etc/systemd/system/docker.service.d
echo -e "[Service]\n
ExecStart=\n
ExecStart=/usr/bin/dockerd --storage-opt dm.basesize=100G" >> /etc/systemd/system/docker.service.d/docker.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment