Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Installation and Setup  ›  Capstone Project

Docker Engine on Linux

Docker Engine ( Linux ) 14 minOn Linux, Docker Engine runs natively as a daemon, installed from Docker's package repository, and the docker group gives a user root-equivalent power over it.

Docker Engine on Linux

The server that will host quicknotes runs Ubuntu, with no screen and no dashboard. There, you do not need Docker Desktop at all: Linux already has the kernel containers need, so you install Docker Engine directly and run it as a background service.

The rule

On Linux, the Engine runs natively: no VM, just a daemon and a socket.

Docker Engine has three parts you should be able to name:

  • dockerd, the daemon, running as a system service;
  • the docker CLI;
  • the socket /var/run/docker.sock, the local door through which the CLI talks to the daemon.

The recommended install uses Docker's own package repository, which carries newer versions than most distributions' built-in packages. On Ubuntu, once that repository is added, the core install is:

sudo apt-get install docker-ce docker-ce-cli containerd.io \
  docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker
sudo docker run hello-world

enable --now starts the daemon immediately and on every boot. The official docs walk through adding the repository; follow them for your distribution rather than copying commands from old blog posts.

By default only root and members of the docker group may open the socket. To use Docker without sudo:

sudo usermod -aG docker $USER
# log out and back in so the new group applies

This comes with a serious warning: anyone who can talk to the daemon can start a container that mounts the host's whole filesystem as root. Membership in the docker group is effectively root access. Add only people you would trust with root. Docker also offers a rootless mode, where the daemon itself runs as an ordinary user, for machines where that trade-off is unacceptable.

The shortcut

When docker fails on Linux, check the path from CLI to daemon in order: is the daemon running, and am I allowed through the socket?

Fixing permission denied on docker.sockStep 1 of 4
  1. Read the message

    It mentions the Docker daemon socket, so the CLI is installed and reached the door but could not open it.

Drills

Answer fast — trust the rule.

quick drill

Why is no virtual machine needed to run containers on a Linux server?

quick drill

Through what does the docker CLI talk to the local daemon on Linux by default?

quick drill

What does sudo systemctl enable --now docker do?

quick drill

Why should you be careful about adding users to the docker group?

Remember

  • On Linux, the Engine runs natively: dockerd as a service, reached through /var/run/docker.sock.
  • Shortcut: check CLI → daemon in order: is it running, and may I use the socket?
  • Trap: the docker group is root in disguise; consider rootless mode where that matters.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainFix permission denied

After installing Docker Engine on Ubuntu, running docker ps prints 'permission denied while trying to connect to the Docker daemon socket'. Explain what the socket is, two ways to fix the error, and the security cost of the common fix.