Skip to main content
GitHub source Wrap docker run and inject W&B environment variables automatically. Pass all arguments through to docker run while injecting:
  • WANDB_API_KEY — Use the current API key so the container can authenticate with W&B without manual configuration.
  • WANDB_DOCKER — Record the resolved image ID so W&B can track which Docker image produced the run.
If nvidia-docker is detected on the host and --runtime is not already set, add --runtime nvidia to the command to enable GPU support by default. Examples: Run python train.py inside my-image Docker container. Inject your W&B API key and the resolved Docker image ID as environment variables in the container so W&B can track your runs and associate them with the image.
wandb docker-run my-image python train.py

Usage

wandb docker-run [OPTIONS] [DOCKER_RUN_ARGS]...

Arguments

docker_run_args

NameDefaultType
docker_run_argsNoneSTRING

Options

help

Show this message and exit.
FlagDefaultType
--helpFalseBOOL

CLI Help

Usage: docker-run [OPTIONS] [DOCKER_RUN_ARGS]...

  Wrap `docker run` and inject W&B environment variables automatically.

  Pass all arguments through to ``docker run`` while injecting:

  - ``WANDB_API_KEY`` — Use the current API key so the container can
  authenticate with W&B without manual configuration. - ``WANDB_DOCKER`` —
  Record the resolved image ID so W&B can track which Docker image produced
  the run.

  If ``nvidia-docker`` is detected on the host and ``--runtime`` is not
  already set, add ``--runtime nvidia`` to the command to enable GPU support
  by default.

  Examples:

  Run ``python train.py`` inside ``my-image`` Docker container. Inject your
  W&B API key and the resolved Docker image ID as environment variables in the
  container so W&B can track your runs and associate them with the image.

  ``` wandb docker-run my-image python train.py ```

Options:
  --help  Show this message and exit.