FIND YOUR NEXT FEW LINES

The snippet library.

Small, practical examples. Search by task or narrow things down below.

20 snippets foundClear filters
Docker / ComposeCompose service options

Read a secret from a mounted file

Docker / Compose: Compose secrets make a file available under /run/secrets.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Run a Compose service as a non-root user

Docker / Compose: user overrides the image’s default identity.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Set a Compose service’s working directory

Docker / Compose: working_dir changes where the container command starts.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Set a service’s open-file limit

Docker / Compose: The ulimits mapping defines soft and hard resource limits.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Set no-new-privileges in Compose

Docker / Compose: security_opt configures the process privilege restriction.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Supply a default for an unset Compose variable

Docker / Compose: The default interpolation form supplies a value when the variable is absent or empty.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Supply a non-secret configuration file

Docker / Compose: A Compose config mounts a declared file into the service.

Docker / Compose✓ Tested
Docker / ComposeCompose service options

Wait for a healthy Compose dependency

Docker / Compose: The service_healthy dependency condition waits for the dependency’s health command to succeed.

Docker / Compose✓ Tested