docker-launch
Create and launch docker containers on multiple hosts.
Features
This library provides:
- SSH public key authentication checker and its set-up command
- Launch multiple Docker containers on arbitrary host(s), via command line or Python script
Installation
pip install docker-launch
Usage
To check if SSH public key authentication to user@192.168.1.1 is enabled or not, run
>>> from docker_launch import check_connection
>>> check_connection("user@192.168.1.1")
True
or from command line,
$ docker-launch check user@192.168.1.1
OK
If the authentication hasn't been set-up, you can configure it via
docker-launch check user@192.168.1.1 --setup
Once the authentication is set-up, let's prepare configuration file path/to/config.toml
[ros_topics]
baseimg = "ros:humble-ros-core"
command = "env ROS_DOMAIN_ID=1 ros2 topic pub {a} std_msgs/msg/Float64 '{{data: 123.45}}'"
targets = [
{ a = "first", __machine__ = "localhost" },
{ a = "/second", __machine__ = "user@172.29.1.2" },
]
This will spawn
ros:humble-ros-corecontainer on the host machine, executing commandenv ROS_DOMAIN_ID=1 ros2 topic pub first std_msgs/msg/Float64 '{data: 123.45}'ros:humble-ros-corecontainer onuser@172.29.1.2, executing commandenv ROS_DOMAIN_ID=1 ros2 topic pub /second std_msgs/msg/Float64 '{data: 123.45}'
by running
>>> from docker_launch import launch_containers
>>> launch_containers("path/to/config.toml", remove=True)
or
docker-launch up path/to/config.toml --rm
For the details of the options, see docker run documentation and Docker SDK's documentation.
Options of docker run command which docker-launch command and docker_launch.launch_containers() function doesn't support
--attach,-a--cgroupns--cidfile--detach,-d(alwaysTrue)--detach-keys--disable-content-trust--env-file--expose--gpus-h(use--hostnameinstead)--interactive,-i--ip--ip6--label-file--link-local-ip--log-driver--log-opt--mount--net(onlybridge,none,host, andcontainer:<name|id>are supported)--net-alias--network(onlybridge,none,host, andcontainer:<name|id>are supported)--network-alias--no-healthcheck--pull--sig-proxy--stop-timeout--ulimit-v(use--volumeinstead)
Options of Docker SDK's docker.containers.run function which docker-launch command doesn't support (docker_launch.launch_containers() function supports them)
auto_removedevice_requestsinit_pathlog_configlxc_confmountsnano_cpusnetworknetwork_disabledstdin_openstdoutstderrstreamulimitsuse_config_proxyversion
Configuration File Spec
The configuration is described in TOML format. Required fields are:
baseimg(string) - Name of the image from which the containers are createdcommand(string) - Command template to execute in each containers, with Python style placeholder (positional placeholder e.g.{0}isn't supported)targets(array of table) - List of parameter tables for each containers, and special parameter__machine__
The fields above must be grouped in a table.
[table-name]
baseimg = "docker:image-name"
command = "command template with {placeholder}"
targets = [
{ placeholder = "this", __machine__ = "user@172.29.1.2" },
{ placeholder = "that" },
]
A configuration file can have multiple tables
[table-1]
baseimg = "docker:image-name"
command = "command template with {placeholder}"
targets = [
{ placeholder = "this", __machine__ = "user@172.29.1.2" },
{ placeholder = "that" },
]
[table-2]
baseimg = "docker:other-image"
command = "other command {parameter} with curly braces {{escaped}}"
targets = [
{ parameter = 100, __machine__ = "user@172.29.1.2" },
{ parameter = 200 },
]
Optional field:
include(array of string) - Paths to additional configuration files
The instruction must be declared at top level (not inside tables).
include = ["path/to/other/config.toml", "/path/to/another/config.toml"]
[table-name]
baseimg = "docker:image-name"
command = "command template with {placeholder}"
targets = [
{ placeholder = "this", __machine__ = "user@172.29.1.2" },
{ placeholder = "that" },
]
This library is using Semantic Versioning.
Metadata
Release files for docker-launch 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| docker-launch-0.2.2.tar.gz | 17.8 kB | Without provenance | Details for docker-launch-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| docker_launch-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for docker_launch-0.2.2-py3-none-any.whl |
Total release size: 36.6 kB
Release files / docker-launch-0.2.2.tar.gz
| Download URL | docker-launch-0.2.2.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a85021059e1731fa40843675d8ebb159fe172a2e4248ea29123a0c6eec4224e
|
|
BLAKE2b-256 checksum How to use checksums |
8eaf94094af31eb3af6454bb6e0456af883d0bc6830705d0bb61b28d0b252fe4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.8.13 Linux/5.15.0-1019-azure
|
Release files / docker_launch-0.2.2-py3-none-any.whl
| Download URL | docker_launch-0.2.2-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b862841bfbadd94570d4669d820304335b712096d3ab73a89925daf1607c0be
|
|
BLAKE2b-256 checksum How to use checksums |
46dfebeb00107aefb3a5fa7a39ba81ce00aa955f4a72a24d6652a471c7ae4a3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.8.13 Linux/5.15.0-1019-azure
|
Security for docker-launch 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.