Docker and Docker-Compose on Ubuntu 16.04 LTS

Patrick

Administrator
Staff member
Dec 21, 2010
12,181
5,257
113
Here is a quick guide to getting setup with Docker and docker-compose on Ubuntu 16.04 LTS

1. Update system, install Docker, and add the current user to the Docker group:
Code:
#!/bin/bash
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install brew
wget -qO- https://get.docker.com/ | sh
usermod -aG docker $USER
2. Logout and back in so you can use docker without sudo. Also, likely best to just do a reboot at this point.

Code:
#!/bin/bash
sudo -i
curl -L https://github.com/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
exit
That should have you working in Ubuntu 16.04 with docker-compose.
 
  • Like
Reactions: wsuff and T_Minus

RTM

Well-Known Member
Jan 26, 2014
756
276
63
As far as I now, you can find docker and docker compose in the official 16.04 repositories, so what is the benefit of using the docker install script (AFAIK it installs their repos)?

I get that you won't find the newest version etc. in the Ubuntu repositories, but something that is probably "good enough".
Are there specific features missing or something like that?
 

wsuff

Member
Aug 16, 2015
74
12
8
The short answer is by using the docker provided one and compose from GitHub you can ensure you have the latest stable build. I've noticed with docker-compose that some of the newer features are only implemented on high versions of docker-compose configs with the appropriate version of docker which can cause problems if you want to test available configuration that assume newer versions.
 

RTM

Well-Known Member
Jan 26, 2014
756
276
63
You know, as a Linux noob, I was always wondering why I had to run Docker stuff as sudo. :oops:
Actually using the docker group thing, rather than sudo is somewhat controversial.
The official Docker package from the RHEL/CentOS/Fedora repos don't let non-root users use docker.
According to this post on project atomic, it is for security reasons, as I understand it you can use docker to escalate to root privileges like sudo, but without the auditing. Of course the post is from 2015, so perhaps things have changed.

The short answer is by using the docker provided one and compose from GitHub you can ensure you have the latest stable build. I've noticed with docker-compose that some of the newer features are only implemented on high versions of docker-compose configs with the appropriate version of docker which can cause problems if you want to test available configuration that assume newer versions.
That is a good point, at least if you use docker compose.
I suppose another reason would be compatibility across host OS's.

A downside to this (in the original post) approach seems to be that you have to update the docker-compose script manually.
 
  • Like
Reactions: wsuff

wsuff

Member
Aug 16, 2015
74
12
8
Seems pip can be used for docker-compose too. Interesting discussion for sure. Thanks @RTM

Sent from my Nexus 6P using Tapatalk