Edited at

Ubuntu 16.04にDockerとDocker-composeをインストール

More than 1 year has passed since last update.

Ubuntu 16.04にDockerとDocker-composeをインストール


First of all

sudo apt-get update

sudo apt-get install git


Prepare project user

sudo useradd -m -s /bin/bash admin

sudo su - admin
ssh-keygen -t rsa -b 4096 // This is for deploy key.


Set up docker official repository

Install packages to allow apt to use a repository over HTTPS.

sudo apt-get install \

apt-transport-https \
ca-certificates \
curl \
software-properties-common
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"


Install Docker CE (Community Edition)

sudo apt-get update

sudo apt-get install docker-ce
docker -v


Install Docker-compose

sudo curl -L https://github.com/docker/compose/releases/download/1.20.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version


Set docker group to project user

sudo gpasswd -a admin docker

sudo systemctl restart docker