Skip to content
FreeCORE

A reverse proxy gives each application a name and a certificate instead of an address and a port. Traefik, and Caddy with the caddy-docker-proxy plugin, discover the other containers and their labels through the Docker API socket and configure themselves from those labels. From FreeCORE 15.2 an application can be given that socket, read-only.

The socket is podman’s own Docker-compatible API behind a filter that answers only what discovery needs: the container list, each container’s labels, addresses and ports, the networks, and the stream of container events. It cannot create, start, stop or change anything. FreeCORE runs it while any application has the option, and stops it when none does.

  • The proxy must reach the applications it fronts. Applications on the Applications bridge reach each other by their bridge addresses, so the simplest layout is the proxy on the bridge with its Host port published, or the proxy attached to the LAN with Also reach the Applications bridge selected. See Applications Networking.
  • The proxy runs as root inside its container. The socket is owned by root and readable by nobody else.

In the install or edit form, or in Import image…, select Container API (read-only). The container then has the socket at /run/freecore/container-api/docker.sock. An imported image has no persistent storage of its own, so a proxy that keeps its configuration in a volume belongs in the catalog install.

Install form with Container API (read-only) selected
FIG 1 Container API Option

Install Traefik from the catalog and select Container API (read-only). The catalog entry keeps Traefik’s configuration in its /config volume, app-owned storage that survives an edit or an update.

  • The entry publishes host ports 80, 443 and 8080. The FreeCORE web interface already listens on 80 and 443, so choose other host ports, such as 8089 and 8443, or select Attach to LAN to give Traefik its own address where it can use 80 and 443.
  • Traefik writes a default traefik.yml at its first start, with the file provider on /config/dynamic and a redirect of every request from port 80 to 443.

Edit traefik.yml in the application’s dataset, <pool>/applications/data/traefik/config, then restart the application. Add the Docker provider beside the file provider:

providers:
file:
directory: /config/dynamic
watch: true
docker:
endpoint: "unix:///run/freecore/container-api/docker.sock"
exposedByDefault: false

exposedByDefault: false publishes only the applications that ask for it. The image reads this file and nothing else, so Traefik’s TRAEFIK_* environment variables have no effect.

Then give each application Traefik should publish its labels under Labels, as on Linux:

Name Description
traefik.enable true
traefik.http.routers.<name>.rule The request rule, for example Host(`photos.example.org`).
traefik.http.routers.<name>.entrypoints web or websecure, the entry points of traefik.yml.
traefik.http.services.<name>.loadbalancer.server.port The application’s container port.

Traefik reads the labels when the application starts and drops its route when it stops. Nothing has to be restarted.

FIG 2 Traefik Dashboard

Screenshot to come: Traefik's dashboard listing a FreeCORE application discovered through the socket.

  • The API lists every container podman knows on the system, not only the applications, and every label on them. Put nothing in a label that the proxy must not read.
  • Only the discovery paths are answered. A proxy that needs to execute commands in containers or read their logs through the socket does not work.
  • An application whose service runs as another user cannot open the socket.