Docker: Unable to execute .sh file located in container

Hi,

I’m setting up git within my docker container and following this guide. My container is not orchestrated, just running on my local Docker.
I’m trying to execute this line of code:

system.util.execute(["/var/lib/ignition/data/git-auto-commit.sh"])

unfortunately, I keep getting the error:
java.io.IOException: Cannot run program “/var/lib/ignition/data/git-auto-commit.sh”: CreateProcess error=2, The system cannot find the file specified

I have made sure it is possible to read and execute the file with the chmod command.

Strangely enough, I am able to execute this code from my gateway:
system.util.execute(["C:\\temp\\exec.bat"])

So the gateway does have access to my local PC’s hard drive. I’m a bit confused on how that works and why the container doesn’t have access to it’s own files but does have access to my files.

In my docker command terminal, I am able to access /var/lib/ignition/data/git-auto-commit.sh and I am not able to access C:\temp\exec.bat. I would expect this is the same for Ignition, since it is installed in that container…

What could be wrong? Is it something to do with scope? Or something with volumes? I executed this script in my python scripts on the gateway.

@kcollins1 @kcollins maybe you know?

This is my docker compose code if that would be important:

version: '3.1'
services:
  gateway:
    image: kcollins/ignition:8.1.15  
    ports:
      - "9089:8088"
    stop_grace_period: 30s
    volumes:
      # - ./gateway_backup.gwbk:/restore.gwbk
      - Ignition9089-data:/var/lib/ignition/data
    logging:
      driver: "json-file"
      options:
        max-size: "200k"
        max-file: "10"
    environment:
      - ACCEPT_IGNITION_EULA=Y
      - IGNITION_EDITION=standard
      - GATEWAY_ADMIN_USERNAME=admin
      - GATEWAY_ADMIN_PASSWORD=password
      - TZ=Europe/Brussels # see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
      - GATEWAY_MODULES_ENABLED=alarm-notification,enterprise-administration,modbus-driver-v2,opc-ua,perspective,reporting,symbol-facory,tag-historian,user-manual,web-developer
    
volumes:
  Ignition9089-data:

EDIT: also tried system.net.getHostName(), it gave me back the hostname of my laptop… So it’s really looking in the wrong device.

Scope seems like a probable issue here… You won’t be able to invoke your execute call against that shell script from Client/Designer scope (either in the Designer Script Console, or in a Vision window via a button). You’ll need to invoke it in gateway scope (since that is where your script presumably exists in the data volume).

There are several ways to approach it, depending on your needs.

These both imply you’re running code in the Client/Designer scope (script console, for example), and not in a scope that executes on the Gateway / in your container.

edit: doh, like Kevin C just said basically.

Thanks guys. Earlier it was the permissions of the ignition user, but that was solved now, and it was indeed the execution scope now.