Skip to main content

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).

Platform credentials

Every mode proxies with the same filters as enlace's mode="process": the container does not see the visitor's platform cookies (enlace_session, enlace_csrf, enlace_oauth_state, shared_auth_*, and a custom [auth] session_cookie_name) or the X-CSRF-Token header, and it can never set a platform cookie or send Clear-Site-Data / Service-Worker-Allowed on the platform's origin. An app that genuinely needs the caller's session can opt in to receiving those credentials (never to setting them):

forward_platform_credentials = true

Dockerfile-per-app

# apps/myapp/app.toml
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

mode = "image"
image = "ghcr.io/myorg/myapp:1.2.3"
port = 8080
env = { LOG_LEVEL = "info" }

docker-compose

mode = "compose"
compose_file = "docker-compose.yml"   # default
service = "web"                       # which service receives HTTP
port = 8080                           # service's internal port

Already-running container

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_asgi that proxies HTTP to the container's published host port;
  • a make_lifecycle (for the supervisable modes) that shells out to docker / docker compose for start, stop, health, and log streaming.

License

Apache-2.0.

Metadata

Release files for enlace_docker 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enlace_docker 0.0.8
File Size Uploaded
enlace_docker-0.0.8.tar.gz 33.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for enlace_docker 0.0.8
File Interpreter ABI Platform
enlace_docker-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 73.2 kB

Release files / enlace_docker-0.0.8.tar.gz

Download URL enlace_docker-0.0.8.tar.gz
Size 33.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8245296be3e6b7930f4db636d0cd1b2dde39110505b5cb0852d4bc84a5e52e2d
BLAKE2b-256 checksum
How to use checksums
13b04c4ef2bc5b82341ad609731534de85c95a831ceedfa6143c3502f12b8753
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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.8-py3-none-any.whl

Download URL enlace_docker-0.0.8-py3-none-any.whl
Size 39.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f827379905c772c286a9f9c262299b1127d456750cb0127c05c0b53e07c0e22f
BLAKE2b-256 checksum
How to use checksums
a746a35abc29a90aabdae8ef2d1274a156338a180826f722ba4307c2d9545f26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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 history Release notifications | RSS feed

0.0.10

2 release files

0.0.9

2 release files

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page