Docker cheat sheet

Install

apt install docker-engine

Also install Docker Compose:
https://docs.docker.com/compose/install/


Usage

Run docker compose detached:
	docker-compose up -d

List containers:
	docker container list

Start a shell inside a container:
	docker exec -it <container ID> /bin/bash

Stop container:
	docker container stop <container ID>

List networks:
	docker network list

Create a network:
	docker network create your-network --subnet 172.24.24.0/24


docker-compose.yml

This file is a setup file for the docker environment.

The volumes section can be used to share files and directories between the host and the client container environment:

services:
  web:
    volumes:
      - ./host/path/to/file/or/folder:/host/path/to/file/or/folder
      - /host/path/to/file/or/folder:/host/path/to/file/or/folder:rw

This is a personal note. Last updated: 2022-02-18 14:41:34.



LinkedIn
Klebe.se

Don't forget to pay my friend a visit too. Joakim