Skip to content

Instantly share code, notes, and snippets.

@bryantrobbins
Last active May 29, 2017 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryantrobbins/30735fd95026ecfceddcf141d2800d75 to your computer and use it in GitHub Desktop.
Save bryantrobbins/30735fd95026ecfceddcf141d2800d75 to your computer and use it in GitHub Desktop.
# 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