services:
  agent:
    image: "{{.Image}}"
    container_name: godoxy-agent
    restart: always
    {{ if eq .ContainerRuntime "podman" -}}
    ports:
      - "{{.Port}}:{{.Port}}/tcp"
      - "{{.Port}}:{{.Port}}/udp"
    {{ else -}}
    network_mode: host # do not change this
    {{ end -}}
    environment:
      {{ if eq .ContainerRuntime "nerdctl" -}}
      DOCKER_SOCKET: "/var/run/containerd/containerd.sock"
      RUNTIME: "nerdctl"
      {{ else if eq .ContainerRuntime "podman" -}}
      DOCKER_SOCKET: "/var/run/podman/podman.sock"
      RUNTIME: "podman"
      {{ else -}}
      DOCKER_SOCKET: "/var/run/docker.sock"
      RUNTIME: "docker"
      {{ end -}}
      AGENT_NAME: "{{.Name}}"
      AGENT_PORT: "{{.Port}}"
      AGENT_CA_CERT: "{{.CACert}}"
      AGENT_SSL_CERT: "{{.SSLCert}}"
      # use agent as a docker socket proxy: [host]:port
      # set LISTEN_ADDR to enable (e.g. 127.0.0.1:2375)
      LISTEN_ADDR:
      POST: false
      ALLOW_RESTARTS: false
      ALLOW_START: false
      ALLOW_STOP: false
      AUTH: false
      BUILD: false
      COMMIT: false
      CONFIGS: false
      CONTAINERS: false
      DISTRIBUTION: false
      EVENTS: true
      EXEC: false
      GRPC: false
      IMAGES: false
      INFO: false
      NETWORKS: false
      NODES: false
      PING: true
      PLUGINS: false
      SECRETS: false
      SERVICES: false
      SESSION: false
      SWARM: false
      SYSTEM: false
      TASKS: false
      VERSION: true
      VOLUMES: false
    volumes:
      {{ if eq .ContainerRuntime "podman" -}}
      - /var/run/podman/podman.sock:/var/run/podman/podman.sock
      {{ else if eq .ContainerRuntime "nerdctl" -}}
      - /var/run/containerd/containerd.sock:/var/run/containerd/containerd.sock
      - /var/lib/nerdctl:/var/lib/nerdctl:ro # required to read metadata like network info
      {{ else -}}
      - /var/run/docker.sock:/var/run/docker.sock
      {{ end -}}
      - ./data:/app/data
