Skip to main content
  1. Building Your Own Server/

Docker Installation

·813 words·4 mins

Docker is a powerful containerization platform that allows you to package applications and their dependencies into isolated containers. By using Docker, you can run multiple services on the same machine without conflicts, making it ideal for self hosted infrastructure. The concept takes a bit to wrap your head around, and I recommend looking at a few Docker 101 pages online. Have different people explain it to you from different view points to help you grasp the concept.

Docker Definitions
#

  • Docker: The software container platform. You download Docker, and point it towards what application you want it to download to your computer.
  • Image: A “lightweight, stand-alone, executable package that includes everything needed to run a piece of software.” For you millennials out there, think of this as the CD for the software.
  • Container: A running copy of the image. This is what the code actually runs in.

Why Docker
#

  • Isolation: Each service runs in its own container, preventing conflicts with other software
  • Portability: Containers work the same way on any system, making installation easy
  • Efficiency: Lightweight alternative to virtual machines
  • Open Source: Think of Docker a bit like an app store, but without the store part. It’s a way for people to share programs with each other and work on projects together.

Installation Prep
#

Before installing Docker, ensure you have the following ready:

  • Operating System: Linux MintYou can do it with windows, but I highly recommend switching to Linux for your server.
  • User Permissions: Your user should be in the sudo group
  • Hardware: Minimum 2GB RAM, 10GB Free Disk Space (This is to make sure you have space for the program images)

Time to Complete
#

  • Total Time: ~15 minutes
    • 5 min: Remove old Docker versions
    • 5 min: Install Docker Engine
    • 3 min: Install Docker Compose
    • 2 min: Verify installation
  • Difficulty: Beginner-Friendly
  • Note: This guide covers Docker Engine and Docker Compose installation.

Remove Old Docker Versions (Optional)
#

If you have older Docker versions installed, remove them first:

sudo apt remove docker docker-engine docker.io containerd runc

Install Docker Engine
#

Step 1: Update Package Index
#

sudo apt update

Step 2: Install Required Dependencies
#

sudo apt install ca-certificates curl gnupg lsb-release

Step 3: Add Docker’s Official GPG Key
#

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Step 4: Add Docker Repository
#

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 5: Update Package Index Again
#

sudo apt update

Step 6: Install Docker Engine
#

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

Step 7: Verify Docker Installation
#

sudo docker --version

You should see output similar to:

Docker version 24.0.7, build 24.0.7-0ubuntu1~22.04.1

Configure Docker for Non-Root User (Optional but Recommended) #

To run Docker commands without sudo, add your user to the docker group:

sudo usermod -aG docker $USER

Log out and log back in for the changes to take effect, or run:

newgrp docker

Install Docker Compose
#

Docker Compose allows you to define and run multi-container Docker applications. Each program you want to run will have a Docker Compose file with all your variables and installation information. In each of my guides, there is a a Docker Compose template to get you started.

Step 1: Download Docker Compose
#

sudo curl -L "https://github.com/docker/compose/releases/download/v2.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Step 2: Apply Executable Permissions
#

sudo chmod +x /usr/local/bin/docker-compose

Step 3: Verify Docker Compose Installation
#

docker-compose --version

You should see output similar to:

Docker Compose version v2.24.0

Usage
#

Basic Docker Commands
#

Command Description
docker ps List running containers
docker ps -a List all containers (including stopped)
docker images List downloaded images
docker stop container-name Stop a running container
docker start container-name Start a stopped container
docker rm container-name Remove a container
docker rmi image-name Remove an image
docker logs container-name View container logs

Basic Docker Compose Commands
#

Command Description
docker-compose up -d Start services in background (Don’t forget the D!')
docker-compose down Stop and remove containers
docker-compose ps List containers
docker-compose logs View logs
docker-compose pull Pull latest images

Maintenance
#

Updates
#

Update Docker and Docker Compose:

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

Cleanup
#

Remove unused images, containers, and volumes:

docker system prune -a

Warning: This removes all unused containers and images. Use with caution.

View System Information
#

docker info

This displays detailed information about your Docker installation.

Resources
#


You’ve successfully installed Docker! You’re now ready to deploy containerized services like Jellyfin, Nextcloud, and more. Docker is the foundation of your self-hosted infrastructure.

Note: All services in this guide assume your Linux Mint machine is at 192.168.99.1. This IP is used throughout the documentation for accessing web interfaces.