Docker

How to use docker

Best-practices

Aka optimizations

Perform your add & remove operations in the same RUN command. Doing them separately creates two separate layers which inflates the image size.

This creates two image layers - the first layer has all the added foo, including any intermediate artifacts. Then the second layer removes the intermediate artifacts, but that's saved as a diff against the previous layer:

RUN ./install-foo RUN ./cleanup-foo

This creates a single layer which has only the foo artifacts you need.

This why the official Dockerfile best practices show the apt cache being cleaned up in the same RUN command:

RUN apt-get update && apt-get install -y package-bar package-baz package-foo && rm -rf /var/lib/apt/lists/*

Lint and security:

Docker compose

Aka compose.yaml (or docker-compose.yml or compose.yml)

Alpine

http://nl.alpinelinux.org/alpine/v3.11/main/ http://dl-cdn.alpinelinux.org/alpine/edge/community

How docker works

AMP

Aka LAMP, Linux Apache MySQL PHP

Virtual Machine

If the host is not Linux or the image use on other OS use a virtual machine container

macOS

Volumes

WebAssembly

Aka wasm

Last updated

Was this helpful?