Run containers without Compose
Use this when a project needs a container or two, such as a mock login provider, and has no Compose file: you declare them in the project file and devlanes runs them through Docker.
::example{slug="infra-plain-containers"}
Declare the container
Section titled “Declare the container”Name the container ports you need; devlanes publishes each on a host port on 127.0.0.1. A container is shared by every lane unless you set per_lane. The ready check makes the start wait until the provider answers, the hostname lets a browser open it, and the variable gives the services its port.
infra: containers: oidc: image: ghcr.io/navikt/mock-oauth2-server:6.1.1 ports: http: 8080 env: JSON_CONFIG_PATH: /config/oidc.json volumes: ["./infra/oidc.json:/config/oidc.json:ro"] per_lane: true ready: http: path: /isalive hosts: oidc: "auth.${{ lane.domain }}"
global_env: OIDC_PORT: ${{ infra.oidc.ports.http }}infraContainers the lanes depend on (databases, brokers, object stores), started and waited on before setup, tasks and services, plus the commands that create and remove each lane's data in them.
Config referenceinfra.containersDocker containers run without a Compose file, keyed by name and reached as infra.<name> in expressions.
infra.containers.<name>Docker container run without a Compose file, shared by every lane or one per lane. Processes reach it through ${{ infra.<name>.ports.<port> }}.
infra.containers.<name>.imageImage to run. Required. A running container with the same image, command, env, mounts and ports is reused; any change recreates it.
Config referenceinfra.containers.<name>.portsContainer ports by name. devlanes publishes each on a host port on 127.0.0.1, read as ${{ infra.<name>.ports.<port> }}; infra.<name>.port is the first one.
infra.containers.<name>.ports.<name>Container ports by name. devlanes publishes each on a host port on 127.0.0.1, read as ${{ infra.<name>.ports.<port> }}; infra.<name>.port is the first one.
infra.containers.<name>.volumesMounts as source:destination[:mode]. ./relative and /absolute sources are bind mounts; relative ones start at the project file's directory, in the lane's worktree for a per_lane container and in the primary worktree for a shared one. A bare name is a named volume kept per project or per lane.
infra.containers.<name>.per_laneRun one container per lane instead of one shared by every lane. Defaults to false. Per-lane containers and their named volumes are removed by devlanes lane clean.
infra.containers.<name>.readyExtra check the start waits for once the container is up (the image's healthcheck, else its first port accepting TCP), before setup, tasks and services run. Write started or one of tcp, http, log (matched against the container's logs) or cmd (run on the host). If it does not pass within its timeout (default 60s), the start fails.
infra.containers.<name>.ready.httpReady once a GET request to path on the unit's main port answers with status, or with a 2xx status when status is unset. Redirects are not followed. Best when the app has a health route that fails while it is broken. Each request sends User-Agent: devlanes-ready, so an app can leave the checks out of its request logs.
infra.containers.<name>.ready.http.pathPath requested with GET, such as /healthz; defaults to /.
infra.hostsHTTPS hostnames for containers, keyed by Compose service or plain container name, so a browser can open a container's web port: a MinIO console or presigned S3 URLs, Mailpit, a mock OIDC provider. A hostname routes to the container's first published port unless its route sets port; each key takes one hostname or route, or a list.
infra.hosts.<name>HTTPS hostnames the devlanes proxy routes to this unit, so a browser reaches it at https://<host>: one hostname or route mapping, or a list of them.
global_envVariables for every service and task of the lane, above devlanes' own variables (PORT, DEVLANES_*) and below each unit's env and the profile's env. Use it for values many units share, such as a database URL built from ${{ infra.postgres.port }}. An entry without a value, such as one that reads a container a profile with infra: false left stopped, fails every service and task of the lane, so a value only some services need belongs in their env. devlanes exec leaves such an entry out and names it. Never set PORT here: it would replace every service's own port.
global_env.<name>Variables for every service and task of the lane, above devlanes' own variables (PORT, DEVLANES_*) and below each unit's env and the profile's env. Use it for values many units share, such as a database URL built from ${{ infra.postgres.port }}. An entry without a value, such as one that reads a container a profile with infra: false left stopped, fails every service and task of the lane, so a value only some services need belongs in their env. devlanes exec leaves such an entry out and names it. Never set PORT here: it would replace every service's own port.
A relative volume path starts at the folder of the project file. The ready check’s fields are in infra.containers.<name>.ready.
Start the lane
Section titled “Start the lane”The start creates the container before setup, tasks and services, and waits until it is ready.
$ devlanes startIf you change the container
Section titled “If you change the container”A start into a running lane leaves its containers as they are. After you change a container’s image, command, variables, mounts or ports, recreate it in that lane:
$ devlanes infra upA shared container follows the project file of the lane that last brought it up, so change it on the main branch.
If containers need to find each other by name
Section titled “If containers need to find each other by name”Plain containers cannot look each other up by name. Put such containers in a Compose file, as in Share one database server between lanes.