Tim Neilen    Books    Now    Quotes

Docker on Ubuntu 18.04

I’ve been using a Gigabyte BRIX as a pseudo home lab machine running ESXi for a while now, but I thought it was time to give containers a try - being fairly familiar with Ubuntu / Debian I decided to download the latest version, 18.04 LTS, to use Docker on Ubuntu. Conveniently enough, during the install process Ubuntu asks if you want to install some popular packages and it was no surprise that Docker was presented as a option.

These packages are based on their new Snapcraft framework which runs applications in a container, so running Docker in a Snap is essentially running a container in a container.


Initially everything seemed to be working swimmingly, no issues with build / push / pull commands - but when trying to use docker-compose after cloning a git repository for ELK it started getting screwy:

sudo docker-compose up -d
        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml

After triple checking that docker-compose.yml did indeed exist, pulling my hair out, and a lot of Google-ing it turns out Snap packages run in an AppArmor sandbox which will set up a private /tmp using a per-snap private mount namespace and mounting a per-snap directory on /tmp, rather than using the host /tmp directory. docker-composer writes files to the /tmp directory and ignores the TMPDIR environment variables, and for whatever reason it just wouldn’t work. While I could of spent a substantial amount of time trying to get it all working, I decided to remove the snap (sudo snap remove docker), and then install Docker using the official method - everything in home lab land was in harmony again!

As a side note, the Docker Snap has been deprecated and is no longer being maintained by Docker. There is some limited discussion about it on the Snapcraft forums, but no clear reason exactly why it was deprecated in the first place.