Skip to content

Instantly share code, notes, and snippets.

@r6m
Last active September 9, 2018 17:24
Show Gist options
  • Save r6m/8c770a08184da00c8479d81c5f0cd1c4 to your computer and use it in GitHub Desktop.
Save r6m/8c770a08184da00c8479d81c5f0cd1c4 to your computer and use it in GitHub Desktop.
install docker & docker-compose on ubuntu 16.04 or newer
#### install docker on ubuntu 16.04 or newer ####
# update repository
sudo apt update
# Install packages to allow apt to use a repository over HTTPS:
sudo apt install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
# Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# add docker repository ubuntu <= 16.04
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# NOTE: for ubuntu 17.10 use this:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
# make sure you install docker from docker repo. (not ubuntu repo)
sudo apt-cache policy docker-ce
# install docker-ce
sudo apt update
sudo apt install docker-ce -y
#### (optional) Execure docker without sudo ####
sudo usermod -aG docker ${USER}
su - ${USER}
id -nG
#### Install docker-compose on ubuntu ####
# NOTE: replace version (1.22.0) with the current_release in github page: https://github.com/docker/compose/releases
sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# set permissions
sudo chmod +x /usr/local/bin/docker-compose
# check if it's working
docker-compose --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment