Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configuration

minienv adds one top-level field to your compose file, plus a per-service field for whichever target you picked.

FieldWherePurpose
x-minienvtop levelChooses and configures the deployment target
x-minienv-k8s-serviceunder a servicePer-service overrides, Kubernetes target
x-minienv-docker-serviceunder a servicePer-service overrides, Docker target

All three are standard compose extension fields, so docker compose ignores them and the same file keeps working locally.

Use the service extension matching your target. The other one is silently ignored.

Configure exactly one target in x-minienv — see Deployers for what each one does and what it needs.

Per-service overrides

Optional — most services need nothing here. Every field is listed in the Configuration Reference.

Kubernetes

services:
  api:
    image: myorg/api:v1
    ports:
      - "8080:8080"
    x-minienv-k8s-service:
      replicas: 2
      resources:
        limits:
          memory: 512Mi

Anything set here overrides the equivalent compose value.

Docker

services:
  api:
    image: myorg/api:v1
    ports:
      - "8080:8080"
    x-minienv-docker-service:
      image:
        tag: +git
      ngrok:
        port: 8080

Supplying what compose does not carry

Your compose file stays as it is. minienv reads image, build, ports, command, environment, healthcheck and depends_on; anything else a target needs comes from the extension.

Kubernetes

These compose keys are not read. Set the extension field when the deployed service needs what they describe:

Compose keySet in x-minienv-k8s-service
entrypointcommand
volumesvolumes and volumeMounts
configsconfigMapFrom, mounted through volumes
secretsmanifests, mounted through volumes
deploy.replicasreplicas
labelspodLabels
usersecurityContext

Storage is declared the Kubernetes way:

x-minienv-k8s-service:
  volumes:
    - name: cache
      emptyDir: {}
  volumeMounts:
    - name: cache
      mountPath: /var/cache

A volume backed by a ConfigMap can come from configMapFrom. One backed by a Secret or PersistentVolumeClaim needs that resource to exist — declare it in a file and list it under manifests.

networks, restart, profiles, working_dir, extra_hosts and expose have no Kubernetes equivalent and are ignored.

Docker

The project reaches the remote host as written, apart from what cannot follow it there: bind mounts, whose host paths do not exist on that machine, and secrets or configs declared with file:. Named volumes are kept.

To carry a host path across anyway, name it under copy and minienv sends it to the remote host and bind mounts it there:

x-minienv-docker-service:
  copy:
    - hostPath: conf/api.yml
      containerPath: /etc/api/api.yml

environment reaches the remote host already interpolated, so ${DB_HOST} arrives as the value it had on your machine. To keep a value off the remote entirely, use the bare - SOME_VAR form: with nothing set locally it stays unresolved, and the remote host supplies it from its own environment.

Next steps