Install Docker

Setup Docker on Ubuntu

Before getting started you must have Docker installed and also Docker-compose in order to run my setups.

I am assuming you are running Ubuntu Linux as this is the most common for web servers nowadays, if you are running a similar system such as Debian, it should also work. Other systems you have to seek for specific details elsewhere.

To upgrade and install both docker and docker-compose on your Ubuntu, copy and paste the following line.

apt-get update && apt-get upgrade -yq && apt-get install -yq docker-compose

As non root

If you are not root, you might have to add sudo before the line and after each &&.

sudo apt-get update && sudo apt-get upgrade -yq && sudo apt-get install -yq docker-compose

Limit log files

Move Docker data to a mounted drive (DigitalOcean: Volume)

Follow these steps if you would like to move Docker data to an attached drive.

I prefer this approach as it gives me more flexibility to scale the storage space for Docker containers. I can also easily perform a snapshot of my containers.

Before proceeding with this step, you must create and attach a Volume.

Replace {NEW_DIR} with your destination, such as /mnt/docker

service docker stop

# /etc/docker/daemon.json:
   "data-root": "/mnt/docker",
   "log-driver": "json-file",
   "log-opts": {
     "max-size": "10m",
     "max-file": "3"

service docker start

Make a backup if you are already running containers!

Emil Moe

Software- and Data Engineer

I created this website to help you empower your infrastructure and so you don't need to spend the same amount of hours as me on researching. I chose to make the site ad-free, so if you like what I do, please consider supporting my Patreon.

Leave a Reply

Your email address will not be published. Required fields are marked *