Trace: Docker

Docker

This is an old revision of the document!


Docker

I use Fedora as baseline, thus all the instructions consider it :-)

Installation

Fedora provides Docker support using Podman or Docker CE. We will stick with Docker CE for now, as provided by package moby-engine (moby is the mascot of Docker):

  1. dnf install moby-engine
  2. systemctl enable docker

Check if Docker is running:

  1. curl –unix-socket /var/run/docker.sock http://localhost/version

Allow other users than root to use Docker by adding them to docker group:

  1. groupadd docker
  2. usermod -aG docker <username>

You will probably want to install docker-compose:

  1. dnf install docker-compose

If you want to run docker inside docker (nested docker instances), you may run the nested docker instance using the default Unix socket docker.sock as a volume. For example:

  1. docker run -v /var/run/docker.sock:/var/run/docker.sock -ti docker

The limitation in using docker.sock as a volume provided by the host is that any docker operations taking place on the nested docker instance actually runs on the base docker container rather than on the nested container (as the commands are routed to the docker.sock, which is actually provided the by host container.

Build new image

  1. Create the file with the instructions to the new image to be build: Dockerfile
  2. Run docker build -t <image name> <directory with Dockerfile>''
work/docker.1639002050.txt.gz · Last modified: 2021/12/08 22:20 by magsilva