Microservices

Microservices

Docker

Install Docker on Ubuntu 16.04

Well it’s kind of a pain so let’s just script it

sudo apt-get update \
&& sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - \
&& sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& sudo apt-get update \
&& echo "Output apt-cache to verify we are installing from the Docker repo instead of the default Ubuntu 16.04 repo" \
&& apt-cache policy docker-ce \
&& sudo apt-get install -y docker-ce \
&& sudo service docker start \
&& echo "Get latest docker compose released tag" \
&& COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4) \
&& sudo curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
&& sudo chmod +x /usr/local/bin/docker-compose \
&& sudo curl -L "https://raw.githubusercontent.com/docker/compose/${COMPOSE_VERSION}/contrib/completion/bash/docker-compose" > /etc/bash_completion.d/docker-compose \
&& echo "Get Docker-Compose Version" \
&& docker-compose -v \
&& sudo usermod -aG docker ${USER} \
&& echo "Make sure docker is now installed" \
&& sudo systemctl is-active --quiet docker && echo "Docker is running"

Install on Ubuntu using a simple command

sudo apt-get update \&& sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - \&& sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \&& sudo apt-get update \&& sudo apt-get install -y docker-ce apache2-utils \&& sudo service docker start \&& sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \&& sudo chmod +x /usr/local/bin/docker-compose \&& sudo usermod -aG docker ${USER}