CLI Options

  1. Docker flags
  2. -f | --file FILE
  3. -t | --timeout SECONDS
  4. -w | --wait SECONDS
  5. --wait-after-healthy SECONDS
  6. --env-file FILE
  7. --pre-stop-hook COMMAND

Docker flags

All docker flags can be used with docker rollout as usual, like --context, --env, --log-level, etc.

docker --context my-remote-context rollout <service-name>

The plugin flags are described below. Some of the options can be defined as container labels.

-f | --file FILE

Path to compose file, can be specified multiple times, like in docker compose.

Example

Single file:

docker rollout -f docker-compose.yml <service-name>

With override file:

docker rollout -f docker-compose.yml -f docker-compose.override.yml <service-name>

-t | --timeout SECONDS

Timeout in seconds to wait for new container to become healthy, if the container has healthcheck defined.

Default: 60

Example

Decrease timeout to 30 seconds:

docker rollout --timeout 30 <service-name>

-w | --wait SECONDS

Time to wait for new container to be ready if healthcheck is not defined.

Default: 10

Example

Increase wait time to 30 seconds for a service that takes longer to start:

docker rollout --wait 30 <service-name>

--wait-after-healthy SECONDS

Time to wait after new container is healthy before removing old container. Works when a healthcheck is defined. Can be useful if the service healthcheck is not reliable and the service needs some time to stabilize (see #27).

Default: 0

Example

Wait 10 seconds after a new container is healthy before terminating the old container:

docker rollout --wait-after-healthy 10 <service-name>

--env-file FILE

Path to env file, can be specified multiple times, like in docker compose.

See Docker Compose documentation.

Example

Single env file:

docker rollout --env-file .env <service-name>

Multiple env files:

docker rollout --env-file .env --env-file .env.prod <service-name>

--pre-stop-hook COMMAND

Label: docker-rollout.pre-stop-hook

Command to run in the old container before stopping it. Can be used for marking the container as unhealthy to gracefully finish running requests before deleting the container, see container draining.

Example

Deploy a new version of the service and mark the old container as unhealthy before stopping it:

docker rollout --pre-stop-hook "touch /tmp/drain && sleep 10" <service-name>

This requires the service to have a healthcheck defined in docker-compose.yml or Dockerfile that will fail if /tmp/drain file exists.