The snippet library.
Small, practical examples. Search by task or narrow things down below.
Attach a descriptive label to a container
Docker / Compose: Attach a descriptive label to a container using a locally available Ubuntu image.
Docker / Compose✓ Tested
Build an image with a default command
Docker / Compose: Build an image with a default command with a complete introductory Dockerfile.
Docker / Compose✓ Tested
Choose an image’s default directory
Docker / Compose: Choose an image’s default directory with a complete introductory Dockerfile.
Docker / Compose✓ Tested
Choose the command a container executes
Docker / Compose: Choose the command a container executes using a locally available Ubuntu image.
Docker / Compose✓ Tested
Create a small file at build time
Docker / Compose: Create a small file at build time with a complete introductory Dockerfile.
Docker / Compose✓ Tested
Define a first Compose service
Docker / Compose: Define a first Compose service in a small Compose file.
Docker / Compose✓ Tested
Disable networking for a Compose command
Docker / Compose: Disable networking for a Compose command in a small Compose file.
Docker / Compose✓ Tested
Disable networking for a local command
Docker / Compose: Disable networking for a local command using a locally available Ubuntu image.
Docker / Compose✓ Tested
Drop Linux capabilities for a simple command
Docker / Compose: Drop Linux capabilities for a simple command using a locally available Ubuntu image.
Docker / Compose✓ Tested
Give a read-only container temporary storage
Docker / Compose: Give a read-only container temporary storage using a locally available Ubuntu image.
Docker / Compose✓ Tested
Inspect a completed container’s exit code
Docker / Compose: Inspect a completed container’s exit code using a locally available Ubuntu image.
Docker / Compose✓ Tested
Inspect the configured container command
Docker / Compose: Inspect the configured container command using a locally available Ubuntu image.
Docker / Compose✓ Tested