Gernot Walzl

Docker

Docker is used to run isolated Linux system environments on a single host.
The idea is based on Linux Containers (LXC).

Contents

Installation

The official Debian repository contains Docker:

sudo apt install docker.io

Enable the user johndoe to use Docker by adding the user to the group docker:

sudo usermod -a -G docker johndoe

Images

Docker Hub provides images of various Linux distributions.
To download the official docker image debian, run the following command:

docker pull debian:latest

List local images:

docker image ls

Create an image

Dockerfile
FROM debian:11
RUN apt-get update && apt-get -y install build-essential
docker build --tag=my-build-env .

Containers

An instance of an image is called container.
To start a container using the image debian with an interactive terminal:

docker run -it --network=none --volume=/home/johndoe/shared:/mnt/shared debian

List running containers:

docker container ls
CONTENT.html source 2023-04-09 2.1 KB