# Docker: Unable to execute .sh file located in container

**URL:** <https://forum.inductiveautomation.com/t/docker-unable-to-execute-sh-file-located-in-container/58034>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [April 5, 2022, 8:24am UTC](https://forum.inductiveautomation.com/t/docker-unable-to-execute-sh-file-located-in-container/58034 "2022-04-05T08:24:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [April 5, 2022, 8:24am UTC](https://forum.inductiveautomation.com/t/docker-unable-to-execute-sh-file-located-in-container/58034/1 "2022-04-05T08:24:23Z")

</div>

Hi,

I’m setting up git within my docker container and following [this guide](https://www.inductiveautomation.com/resources/article/ignition-8-deployment-best-practices#:~:text=A%20Source%20Control%20System%20is,the%20changes%20which%20are%20stored.). My container is not orchestrated, just running on my local Docker.  
I’m trying to execute this line of code:

```auto
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.

@kcollins @kcollins maybe you know?

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [April 5, 2022, 1:47pm UTC](https://forum.inductiveautomation.com/t/docker-unable-to-execute-sh-file-located-in-container/58034/2 "2022-04-05T13:47:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 5, 2022, 1:51pm UTC](https://forum.inductiveautomation.com/t/docker-unable-to-execute-sh-file-located-in-container/58034/3 "2022-04-05T13:51:08Z")

</div>

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

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

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.

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [April 5, 2022, 2:08pm UTC](https://forum.inductiveautomation.com/t/docker-unable-to-execute-sh-file-located-in-container/58034/4 "2022-04-05T14:08:54Z")

</div>

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