Docker Install

Setting up Docker on Ubuntu MATE involves installing Docker, configuring it, and ensuring it runs smoothly. Below is a step-by-step guide based on the latest information available:

Step 1: Update System Packages

Ensure your system is up to date to avoid compatibility issues.

sudo apt update && sudo apt upgrade -y

Step 2: Install Required Dependencies

Install packages needed for Docker installation.

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

Step 3: Add Docker’s Official GPG Key

This ensures the authenticity of the Docker packages.

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

Step 4: Add Docker Repository

Add the Docker repository to your system’s sources. Ubuntu MATE is based on Ubuntu, so use the Ubuntu 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

Step 5: Install Docker

Update the package index and install Docker Engine and related tools.

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io

Step 6: Verify Docker Installation

Check if Docker is installed and running.

sudo systemctl status docker
Ensure the service is active. If not, start it:
sudo systemctl start docker
sudo systemctl enable docker

Step 7: Allow Non-Root User Access (Optional)

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

sudo usermod -aG docker $USER

Log out and back in for the group change to take effect, or run:

newgrp docker

Step 8: Test Docker

Run a test container to confirm Docker is working.

docker run hello-world

This pulls a small test image and runs it, displaying a confirmation message if successful.

Step 9: Install Docker Compose (Optional)

Docker Compose is useful for managing multi-container applications. Install it with:

sudo apt install -y docker-compose

Verify the installation:

docker-compose --version

Troubleshooting Tips

  • Docker service not starting: Check logs with journalctl -u docker.service for errors.
  • Permission issues: Ensure your user is in the docker group or use sudo for Docker commands.
  • Repository issues: If the repository setup fails, verify $(lsb_release -cs) matches a supported Ubuntu codename (e.g., jammy for Ubuntu 22.04). Ubuntu MATE typically aligns with Ubuntu’s LTS releases.

Notes

  • Ubuntu MATE Specificity: Ubuntu MATE uses the same package management as Ubuntu, so no special adjustments are needed.
  • Docker Desktop: Docker Desktop is not officially supported on Linux, but the CLI and Compose work fine for most use cases.
  • Security: Avoid running untrusted containers, as Docker containers can have root-level access to the host.