@docker Connector

The docker connector allows you to build Docker images or modify running Docker containers. You can pass either an image name or existing container ID:

  • Image - will create a new container from the image, execute operations against it, save into a new Docker image and remove the container
  • Existing container ID - will execute operations against the running container, leaving it running
# A Docker base image must be provided
pyinfra @docker/alpine:3.8 ...

# pyinfra can run on multiple Docker images in parallel
pyinfra @docker/alpine:3.8,@docker/ubuntu:bionic ...

# Execute against a running container
pyinfra @docker/2beb8c15a1b1 ...


pyinfra @docker/name ...

Available Data

The following keys can be set as host or group data to control how this connector interacts with the target.

Key Description Type Default
docker_identifier ID of container or image to start from str