Docker Compose

docker compose run

Create a one-off container using a service configuration. --rm removes it after exit; --no-deps avoids starting dependencies; -e sets a runtime environment entry; -T disables TTY. Use approved local image and no published ports. For this offline lab specify --pull never; verify the original worker ID before and after the separate invocation.

Formal Syntax & Structure

docker syntaxdocker
docker compose run [OPTIONS] SERVICE [COMMAND] [ARGS...]

Parameters & Attributes

NameTypeDescription
SERVICEstringService key
-estringSynthetic runtime variable
--rmstringRemove one-off container on exit

Working Example

Example Snippetdocker
docker compose -f compose.yaml -p bm-v13-env-file run --rm --no-deps -T --pull never -e BM13_COLOR=amber worker printenv BM13_COLOR
Docker Reference