Facing error when running python script on worker nodes

Tried with multiple containers as well, confirmed that mono executable path is present in Octo.

docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: “mono”: executable file not found in $PATH: unknown.

Hi @Naman.Kumar,

Sorry to hear you’re hitting this error with running python scripts in containers!

I think I might need a bit more info about your goal and current setup. Could you please expand a bit further on what you mean by:

mono executable path is present in Octo

Are you using a public docker image which is giving you this error or a custom one?

Usually errors such as ‘unable to start container process: exec: “XXXX”: executable file not found in $PATH: unknown’ would suggest the dockerfile Entrypoint is missing a command, however we usually suggest using the Self Contained Calamari rather than using Mono, is there a specific reason you require it?

From my understanding, it seems like your goal is to have Linux Workers which use SSH connections instead of Linux Tentacle execute custom python scripts inside docker containers. Is this correct? Is there a specific reason you aren’t able to use the Linux Tentacle?

Let me know any extra info about your intended setup and I’d be happy to help get it working!

Best Regards,

Hi @finnian.dempsey ,

Yes, we are using Linux Workers that use SSH connection, and are willing to run custom python scripts inside docker containers. Does Octo not support this setup?

Hi Naman,

Thanks for confirming that!

Octopus will definitely support this setup, however the process might be a little different for older versions or for certain distributions of Linux. Could you please confirm which versions of Octopus and Linux you are using?

I’ve managed to successfully execute a Python Script in a Container using the SSH connection (Self Contained Calamari) on my local setup using Octopus 2022.2 and Ubuntu with the following steps:

  1. Configure a linux VM and install Docker
  2. Add this VM to a Worker Pool in Octopus using an SSH connection (the user account will need permission to create a Docker container e.g. root)
  3. Create an Octopus Project with a Run a Script Step, choosing to run on the SSH worker and run in an Execution Container choosing to use our WorkerTools Image (this will require adding Docker as an External Feed)

Let me know how you get on or if you have any questions at all!

Best Regards,

Hi Naman,

I’ve just tried using Mono and have encountered the same error as you have. Is there a specific reason you need to use Mono instead of the Self Contained Calamari?

I’ll keep digging into this and see if I can get it working with Mono and keep you posted!

Best Regards,

Hi Naman,

I’ve managed to successfully run Python Scripts in Containers using Mono by installing the dependency inside a custom Docker image.

Starting with the Dockerfile from our public WorkerTools image as a base (I’d recommend making an image specific for your needs), I was able to successfully run python scripts using Mono with the following addition at the end of the Dockerfile:

RUN apt-get install mono-complete -y

However it looks like we could be removing our dependency on Mono, so I’d definitely look into using Self Contained Calamari or Tentacle if at all possible. Please let us know your feedback!

Feel free to let me know if you have any questions at all!

Best Regards,

Hi @finnian.dempsey

Thanks for looking into this. Although it is still not resolved
The image we are trying to run is public.ecr.aws/docker/library/python:slim

When adding RUN apt-get install mono-complete -y on it and creating a new image from this dockerfile I am getting the error

[2/2] RUN apt-get install mono-complete -y:
#5 0.263 Reading package lists…
#5 0.272 Building dependency tree…
#5 0.273 Reading state information…
#5 0.275 E: Unable to locate package mono-complete

Hey @Naman.Kumar,

I am not sure whether this will help but a few websites I found with similar errors to what you are getting mention having to run:

sudo apt update

Before runnging the install of Mono:

sudo apt install mono-complete

There are articles below on how to install Mono on Linux which may be helpful. I am sorry if you have seen those already or did run the update command before hand but I just wanted to post this up in case it was useful.

I will note, you didn’t mention what version of Linux you are running, I have seen two articles where installing Mono is a little different (linked below) are you running Ubuntu and if so what version?

Ubuntu 18.04 Mono Install (sudo apt update command required)
Ubuntu 20.04 Mono Install

If you run the below command on the container what output do you get:

mono --version

Let me know if it did help, if not we can dig into it again for you.

Kind Regards,