enlace_docker
Docker / docker-compose backend strategies for enlace.
Installing this package adds four new mode values to app.toml:
| Mode | What enlace does |
|---|---|
docker |
Build the app's Dockerfile, run the container, supervise, route HTTP to it |
image |
Pull a pre-built image, run it, supervise, route HTTP to it (no build step) |
compose |
docker compose up -d the app's stack, route HTTP to a declared service+port, down on shutdown |
docker_attached |
Route HTTP to an already-running container by name (no lifecycle management) |
No code change in enlace is needed — enlace_docker registers via the
enlace.backend_strategies entry-point group. Installing the package is
enough.
Status
Scope: dev orchestration only. Production runs docker compose up out of
band; enlace routes to it via the built-in mode=external. This package
covers enlace serve / enlace dev. See
enlace#3 for the design.
Install
pip install enlace_docker
Requires the docker CLI on PATH. Compose support requires docker compose
(the v2 plugin, not the legacy docker-compose).
Usage
Network exposure
Containers enlace starts (docker, image modes) publish their port on the
host's loopback interface only (127.0.0.1:<port>:<port>), so they are
reachable solely through the enlace gateway, where auth is applied. For
compose and docker_attached, the port mapping is yours: enlace logs a
warning when the routed port is published on a non-loopback address — publish
it as "127.0.0.1::<port>" (compose) or -p 127.0.0.1:<port>:<port> (docker
run). Note that on Docker Engine < 28, hosts on the same L2 network could still
reach loopback-published ports (moby/moby#45610).
Dockerfile-per-app
# apps/myapp/app.toml
[app]
mode = "docker"
port = 8080 # in-container port to expose
dockerfile = "Dockerfile" # default
context = "." # default
build_args = { ENV = "dev" }
env = { LOG_LEVEL = "info" }
Pre-built image
[app]
mode = "image"
image = "ghcr.io/myorg/myapp:1.2.3"
port = 8080
env = { LOG_LEVEL = "info" }
docker-compose
[app]
mode = "compose"
compose_file = "docker-compose.yml" # default
service = "web" # which service receives HTTP
port = 8080 # service's internal port
Already-running container
[app]
mode = "docker_attached"
container = "my-running-container"
port = 8080
How it works
Each mode registers a BackendStrategy against enlace's open/closed
extension point. The strategy provides:
- a TOML field overlay so app.toml carries docker-specific config;
- a
make_asgithat proxies HTTP to the container's published host port; - a
make_lifecycle(for the supervisable modes) that shells out todocker/docker composefor start, stop, health, and log streaming.
License
Apache-2.0.
Metadata
Release files for enlace_docker 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| enlace_docker-0.0.6.tar.gz | 30.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| enlace_docker-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 66.7 kB
Release files / enlace_docker-0.0.6.tar.gz
| Download URL | enlace_docker-0.0.6.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1adbc2730dbc4d02403f16935386d8f158b7ddf94d83d81ca16c46bf850e00ce
|
|
BLAKE2b-256 checksum How to use checksums |
aa824ad4b4af64df35b5911cefe81de8dea82fc20a43574b8b603a9869ab7ea1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / enlace_docker-0.0.6-py3-none-any.whl
| Download URL | enlace_docker-0.0.6-py3-none-any.whl |
|---|---|
| Size | 36.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c6af28c7d16290b4c69f947ee5a51bec7a555fe7ce973f8ca4605c7c59dfe26
|
|
BLAKE2b-256 checksum How to use checksums |
eed13f0bfa3eba45e0c76f98fb1365fad6a6e41dfa3446509ba26d012a318d60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|