Docker is a solution for managing application containers on a Linux system. It works by providing a sandboxed environment based on file system layers for your applications to run inside. It’s great because it means when you build an image locally, it’ll work on your colleagues machine, your servers or even on your Raspberry Pi!
I use it daily, and it’s a core part of the Dokku project, which I wrote about recently. Let’s install Docker on Ubuntu 16.04 now, it’s really simple, and it’s today’s quick tip!
As I mentioned before, don’t just blindly execute “one liners” like the one below without taking the time to read them first. It’s always possible that due to some maliciousness, the script has been changed and could do damage to your system or install security back doors that you would never know about.Read the source of the Docker install script, and make it a habit!
$ curl -sSL https://get.docker.com/ | sh
The script will add the correct repos for you and download Docker, and set it up for you. You may need to allow your user into the docker group, you can do this by issuing the following script:
$ sudo adduser ubuntu docker
Substitute the ubuntu user for the non-root user you’re currently logged in with.
Hopefully Docker is now running on your system, and your login user is in the correct Docker group. Check everything went well by typing:
$ docker run hello-world