Skip to content

Instantly share code, notes, and snippets.

Last active Oct 25, 2015
What would you like to do?
Docker on Ubuntu

Prepare Ubuntu server for Docker

Lets start up-to-date everything:

sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get dist-upgrade -y

Update your apt sources

apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

See Ubuntu version:

lsb_release -a

Edit sources:

sudo nano /etc/apt/sources.list.d/docker.list

Paste depending on your version:

# Ubuntu Precise
deb ubuntu-precise main
# Ubuntu Trusty
deb ubuntu-trusty main
# Ubuntu Vivid
deb ubuntu-vivid main
# Ubuntu Wily
deb ubuntu-wily main

Finish with CTRL+X -> Y


Install everything and reboot the machine:

sudo apt-get update
sudo apt-get purge lxc-docker*
sudo apt-cache policy docker-engine
sudo apt-get update
sudo apt-get install linux-image-generic-lts-trusty -y
sudo reboot

After reboot:

sudo apt-get update
sudo apt-get install docker-engine -y

Docker Compose

sudo apt-get -y install python-pip
sudo pip install -U docker-compose


Free space:

sudo apt-get clean
sudo apt-get autoremove -y
sudo apt-get autoclean

sudo no more

Edit group, you must log out:

# Replace 'USER' with your current session
sudo usermod -aG docker USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment