CLI Options

  1. Docker flags
  2. -f | --file PATH
  3. -t | --timeout SECONDS
  4. -w | --wait SECONDS
  5. --wait-after-healthy SECONDS
  6. --env-file PATH
  7. -p | --project-name NAME
  8. --profile NAME
  9. --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 PATH

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.

The default gives the reverse proxy time to start routing traffic to the new container before the old one is stopped. Traefik, for example, picks up a new container only after its healthy event and throttles configuration reloads (providers.providersThrottleDuration, 2 seconds by default). Without this delay, the old container could be removed before the proxy knows about the new one, briefly leaving it with no backend. Increase it if the service healthcheck is not reliable and the service needs some time to stabilize (see #27), or set it to 0 to disable the delay.

This delay doesn’t drain requests from the old container. To avoid errors while the old container is stopping, see container draining.

Default: 3

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 PATH

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>

-p | --project-name NAME

Project name, as in docker compose.

See Docker Compose documentation.

Example

docker rollout --project-name my-project <service-name>

--profile NAME

Specify a profile to enable, as in docker compose.

See Docker Compose documentation.

Example

docker rollout --profile my-profile <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.