How to Install Docker

Docker is a powerful containerization platform that allows you to run applications in isolated containers. It is the simplest yet default way to run Gluesync. This guide provides installation instructions for Linux, Windows, and Mac operating systems.

Linux

Rootless Docker

Docker can be configured to run without root privileges using rootless mode. This enhances security by allowing Docker to run as a regular user. For detailed instructions, see: https://docs.docker.com/engine/security/rootless/

Distribution-Specific Installation

Fedora

Enable the Docker repository:

sudo dnf -y install dnf-plugins-core
echo "[docker-stable]" | sudo tee /etc/yum.repos.d/docker-ce.repo

Install Docker:

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

Start and enable Docker:

sudo systemctl start docker
sudo systemctl enable docker

Ubuntu

Update package index and install required packages:

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Set up the repository:

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

Install Docker:

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

RedHat

Install required packages:

sudo yum install -y yum-utils

Add Docker repository:

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Install Docker:

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

Start Docker:

sudo systemctl start docker
sudo systemctl enable docker

Debian

Update package index:

sudo apt-get update

Install required packages:

sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release

Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Set up the repository:

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

Install Docker:

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

CentOS

Install required packages:

sudo yum install -y yum-utils

Add Docker repository:

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Install Docker:

sudo yum install docker-ce docker-ce-cli containerd.io

Start Docker:

sudo systemctl start docker
sudo systemctl enable docker

AWS Amazon Linux 2023

Install Docker Engine

Update your system packages:

sudo dnf update -y

Install Docker:

sudo dnf install -y docker

Enable and start the Docker service:

sudo systemctl enable docker
sudo systemctl start docker

Add your user to the Docker group (replace $USER with your username if needed):

sudo usermod -a -G docker $USER
Install Docker Compose

Create the directory for Docker CLI plugins:

sudo mkdir -p /usr/libexec/docker/cli-plugins/

Download the latest Docker Compose binary:

sudo curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-$(uname -m) -o /usr/libexec/docker/cli-plugins/docker-compose

Make the binary executable:

sudo chmod +x /usr/libexec/docker/cli-plugins/docker-compose

Reboot the system to apply changes:

sudo reboot

Check Docker version:

docker version

Check running Docker containers without sudo:

docker ps

Check Docker Compose version:

docker compose version

Configure Log Driver and Retention

Follow this steps to configure Docker’s logging driver and retention policy to avoid running out of disk space. As it is not being automatically configured by Docker at install time.

You can customize Docker’s logging configuration by creating or modifying /etc/docker/daemon.json:

{
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "100m",
        "max-file": "5"
    }
}

Restart Docker after making changes:

systemctl restart docker

Auto-start Configuration

Using systemd (Most Linux distributions)

Most modern Linux distributions use systemd to manage system services. Docker is typically configured to start automatically on boot, but you can verify and manage this behavior using the following commands:

Enable Docker to Start on Boot

To ensure Docker and containerd start automatically at system boot, run:

sudo systemctl enable --now docker.service
sudo systemctl enable --now containerd.service

The --now flag will also start the services immediately in addition to enabling them.

Disable Automatic Startup

If you need to prevent Docker from starting at boot, use:

sudo systemctl disable --now docker.service
sudo systemctl disable --now containerd.service

Customize Docker Service Configuration

You can customize Docker’s behavior by creating or modifying systemd drop-in files. For example, to configure an HTTP proxy or set a custom directory for Docker runtime files:

Create a systemd drop-in directory:

sudo mkdir -p /etc/systemd/system/docker.service.d/

Create a custom configuration file (e.g., http-proxy.conf):

[Service]
Environment="HTTP_PROXY=http://proxy.example.com:8080/"
Environment="HTTPS_PROXY=http://proxy.example.com:8080/"
Environment="NO_PROXY=localhost,127.0.0.1,.example.com"

Reload systemd and restart Docker:

sudo systemctl daemon-reload
sudo systemctl restart docker

For more configuration options, refer to the official Docker documentation on systemd configuration.

Post-Installation Configuration

Docker Registry Access Requirements

In order to have Gluesync working with Docker and allow pulling Gluesync’s Docker images, the host machine must be able to access Docker Hub Registry.

In case you cannot access Docker Hub Registry, there are two ways to work around Docker Hub access restrictions:

  1. Allow (whitelist) Docker registry at your proxy/firewall level, specifically allowing the following trusted domains:

    • *.docker.io

    • *.docker.com

    • *.dckr.io

  2. Save and load images manually if you cannot access Docker Hub:

# Save the image to a tar file
docker image XYZ save > image.tar

# Load the image on your private registry or local machine
docker image load < image.tar
Manually loading images from a tar file is a labor intensive process and is not recommended, as it requires downloading the images from Docker Hub and loading them manually.

macOS

Installation

  1. Download Docker Desktop for Mac from the official Docker website: https://www.docker.com/products/docker-desktop/

  2. Open the downloaded .dmg file and drag Docker.app to the Applications folder

  3. Launch Docker from your Applications folder

  4. Follow the on-screen instructions to complete the setup

Auto-start Configuration

Docker Desktop for Mac can be configured to start automatically when you log in to your Mac. There are two ways to enable this:

  1. Open "System Settings" (or "System Preferences" in older macOS versions)

  2. Go to "General" and then "Login Items"

  3. Click the "+" button to add Docker to the list of applications that start automatically

  4. Select Docker.app from your Applications folder

  5. Make sure the "Hide" option is unchecked to see the Docker icon in the menu bar

Using Command Line (Advanced)

For advanced users who prefer command-line configuration:

  1. Create a LaunchAgent configuration file:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>Label</key>
      <string>com.docker.docker</string>
      <key>ProgramArguments</key>
      <array>
        <string>/Applications/Docker.app/Contents/MacOS/Docker</string>
      </array>
      <key>RunAtLoad</key>
      <true/>
      <key>KeepAlive</key>
      <true/>
      <key>StandardErrorPath</key>
      <string>/tmp/com.docker.docker.err</string>
      <key>StandardOutPath</key>
      <string>/tmp/com.docker.docker.out</string>
    </dict>
    </plist>
  2. Save this file as ~/Library/LaunchAgents/com.docker.docker.plist

  3. Load the launch agent:

    launchctl load ~/Library/LaunchAgents/com.docker.docker.plist
  4. Verify the agent is loaded:

launchctl list | grep com.docker.docker

Verifying Auto-start

After configuring auto-start, restart your Mac to verify that Docker starts automatically. The Docker icon should appear in your menu bar, and you can check its status by clicking on it.

To manually start Docker if needed:

Verify Docker Installation

Before attempting to run Gluesync, verify that Docker is working correctly by running the hello-world container:

docker run hello-world

You should see a message indicating that your installation is working correctly. If you encounter any errors, resolve them before proceeding with Gluesync.

Windows

Windows Server for Windows Containers

Run PowerShell as Administrator

Open PowerShell with administrative privileges. When prompted with "Do you want this app to make changes to your device?", select Yes to continue.

Installation of docker engine:

To get started with Docker on Windows Server, use the following command to run the install-docker-ce.ps1 PowerShell script. This script configures your environment to enable container-related OS features. The script also installs the Docker runtime.

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -o install-docker-ce.ps1
.\install-docker-ce.ps1

Installation of docker-compose:

Create the destination directory

New-Item -ItemType Directory -Path "$Env:ProgramFiles\Docker" -Force

(Optional) Ensure TLS 1.2 is Enabled

GitHub requires TLS 1.2 for secure connections. If you are using an older version of Windows Server (for example 2016), or suspect that TLS 1.2 is not enabled, run the following command:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Download Docker Compose

Download the latest release of Docker Compose with this command:

Start-BitsTransfer -Source "https://github.com/docker/compose/releases/download/v2.39.3/docker-compose-windows-x86_64.exe" -Destination $Env:ProgramFiles\Docker\docker-compose.exe

You can find the latest version on the GitHub releases page and replace v2.39.3 with the desired version number.

Add docker-compose to PATH

This PowerShell snippet adds $Env:ProgramFiles\Docker to the system PATH variable without truncating the existing value.

$oldPath = [Environment]::GetEnvironmentVariable("Path", "Machine")
$newPath = if ($oldPath.Split(";") -contains "$Env:ProgramFiles\Docker") { $oldPath } else { $oldPath + ";$Env:ProgramFiles\Docker" }
[Environment]::SetEnvironmentVariable("Path", $newPath, "Machine")

Restart your PowerShell session to apply the changes or run

$Env:PATH += ";$Env:ProgramFiles\Docker"

Test the Installation

Verify that Docker Compose has been installed correctly:

docker-compose version

Example output:

Docker Compose version <installed-version>>

This guide is inspired by official Microsoft & Docker documentation

Windows Server for WSL

This installation is only available for Windows Server with desktop environment.

Other installation methods (manual):

Install WSL 2 by running the following command from your PowerShell:

wsl --install -d <distro> #you can select the distribution you want to install (e.g. Ubuntu)

Install Docker Desktop for Windows Server:

  • Install docker-desktop on the official site.

  • Then execute the installer and follow configuration step on-screen.

After installation completes, verify Docker is running by opening a new Command Prompt and running:

docker --version