Automate Import project using docker compose

Hello everyone, I have an issue that might be silly or I missing something. I can't automate importing projects with docker compose.

services:
  edge:
    image: inductiveautomation/ignition:latest
    ports:
      - 9050:8088
    volumes:
      - edge-data:/usr/local/bin/ignition/data
      - ./gw-init/backup.gwbk:/backup.gwbk
    networks:
      edge:
        aliases:
          - edge-server
    environment:
      - IGNITION_EDITION=edge
      - GATEWAY_ADMIN_PASSWORD=password
      - ACCEPT_IGNITION_EULA=Y
    command: >
      -n Edge
      -r /backup.gwbk

  trans:
    image: inductiveautomation/ignition:latest
    ports:
      - 9051:8088
    volumes:
      - trans-data:/usr/local/bin/ignition/data
      - ./gw-init/Trans:/usr/local/bin/ignition/data/projects/Trans
    networks:
      edge:
        aliases:
          - trans-server
    environment:
      - IGNITION_EDITION=standard
      - GATEWAY_ADMIN_PASSWORD=password
      - ACCEPT_IGNITION_EULA=Y
    command:
      -n TranslationManager
volumes:
  edge-data:
  trans-data:
networks:
  edge:

My docker-compose looks like that, but the trans container fail to start and I have this errors in logs:

jvm 1    | 2024/01/31 09:24:07 | E [c.i.i.g.p.ProjectFileTree     ] [09:24:07]: Unable to create resource dir: /usr/local/bin/ignition/data/projects/.resources
jvm 1    | 2024/01/31 09:24:07 | E [c.i.i.g.p.ProjectFileTree     ] [09:24:07]: Error creating digest for resourceManifest=/usr/local/bin/ignition/data/projects/Trans/com.inductiveautomation.perspective/views/TranslationsManager/EmbView/Key/resource.json, file=thumbnail.png
jvm 1    | 2024/01/31 09:24:07 | java.nio.file.NoSuchFileException: /usr/local/bin/ignition/data/projects/.resources/9190b2661556b3c4c485f975e7184ce6243b04dbaa7224013d37632aabec0841

Thanks for the help

There is an unfortunate behavior w/ bind-mounts where preceding folders that need to be created get created with root ownership. The easiest way to proceed is to leverage our root step-down functionality to launch the container as root, adjust filesystem permissions as needed, and then launch the gateway as the target user.

Add a user: "0:0" to your service alongside additional env vars IGNITION_UID and IGNITION_GID (you might need to match these to your user ID if you're running Docker Engine on Linux directly, otherwise, leave them at the default 2003 to match our container image default ignition user).

Try the following adjustment to your trans service:

# ...
  trans:
    image: inductiveautomation/ignition:latest
    ports:
      - 9051:8088
    volumes:
      - trans-data:/usr/local/bin/ignition/data
      - ./gw-init/Trans:/usr/local/bin/ignition/data/projects/Trans
    networks:
      edge:
        aliases:
          - trans-server
    user: 0:0
    environment:
      - IGNITION_EDITION=standard
      - GATEWAY_ADMIN_PASSWORD=password
      - ACCEPT_IGNITION_EULA=Y
      - IGNITION_UID=2003
      - IGNITION_GID=2003
    command:
      -n TranslationManager