@docker
Connector¶
The Docker connector allows you to use pyinfra to create new Docker images or modify running Docker containers.
Note
The Docker connector allows pyinfra to target Docker containers as inventory and is unrelated to the Docker Operations & Docker Facts.
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 ...
The Docker connector is great for testing pyinfra operations locally, rather than connecting to a remote host over SSH each time. This gives you a fast, local-first devloop to iterate on when writing deploys, operations or facts.
Usage¶
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 |