Last active
May 29, 2017 12:02
-
-
Save bryantrobbins/30735fd95026ecfceddcf141d2800d75 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Get package updates | |
sudo yum update -y | |
# Check if docker installed | |
installed=`yum list installed | grep docker` | |
if [[ -z "${installed}" ]]; then | |
# Docker install steps required for AMI (Amazon Linux) | |
sudo yum install docker -y | |
sudo service docker start | |
sudo usermod -a -G docker ec2-user | |
# Group membership changes require new SSH shell session to pick up | |
# It seems that Jenkins keeps the same SSH session used during init open for running jobs. | |
# Without new SSH session or login/logout, Jenkins user (ec2-user) is not in the docker group. | |
# | |
# Current hack: Reboot after install to force new session, then skip Docker install + reboot on resulting Jenkins retry | |
sudo reboot | |
else | |
echo "Docker is already installed. Proceeding." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment