Skip to content

Docker Setup

Note

Installation instructions sourced from Docker's official site.

Add Docker's apt repository:

sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

sudo chmod a+r /etc/apt/keyrings/docker.asc
Add the repository to APT sources:

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Install the Docker packages:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Verify that the Docker Engine installation is successful by running the hello-world image:

sudo docker run --name hello-world-container hello-world

You have now successfully installed and started Docker Engine.

Remove the hello-world container by running:

sudo docker rm hello-world-container

Install Portainer CE

Note

Installation instructions sourced from Portainer's official documentation.

I like to run Portainer to manage all of my containers.

First, create the volume that Portainer Server will use to store its database:

sudo docker volume create portainer_data

Then, download and install the Portainer Server container:

sudo docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

Portainer Server has now been installed. You can check to see whether the Portainer Server container has started by running:

docker ps

Now that the installation is complete, you can log into your Portainer Server instance by opening a web browser and going to:

https://<ipaddress>:9443

You will then be required to set up for the first time and create a new user. You can also check or uncheck the box allowing Portainer to collect anonymous statistics.

Managing Additional Docker Hosts

Once you have set up your docker environment, you may wish to have more than one Docker server and manage those from the same interface.

I currently have 3 servers running Docker that are seperated by roles:

  • plex: runs all of my media server content
  • docker: runs anything not related to media
  • tdarr: specifically runs tdarr on this host

This can be done by:

  1. Installing Ubuntu on another server.
  2. Installing Docker as described above.
  3. Installing the Portainer agent on the new server.

You can add the docker host by logging into you Portainer web interface and navigating to Environments and clicking on "+ Add environment":

Add environment menu

From here you can click on "Docker Standalone" and "Start Wizard":

Add environment menu 2

In the Environment Wizard, select "Agent". Give the new environment a name, and provide the address of the new Docker server with port 9001.

Add environment menu 3

You can then copy the docker run command and run it on your new Docker server. Once the container has finished installing on the new server, click the "Connect" button in the Wizard.

The new server will be added as a new "Environment" and can be managed from the same Portainer web interface.