How to run scripts in a docker image using Apptainer?

336 Views Asked by At

I created a docker image to run some scripts. I copy 2 Python scripts into my Docker image. The end of my Dockerfile looks like this.

COPY . /app
ENTRYPOINT ["python3"]

When I want to run it using Docker I simply run

Docker run -i image_name script1.py ... -other -flags

or

Docker run -i image_name script2.py ... -other -flags

I'd like to be able to do something similar thing using Apptainer.

I've looked at these commands in Apptainer.

apptainer shell <container>
apptainer exec <container> <command>
apptainer run <container>
apptainer instance start <container> [name]

But when I try to run script1.py or script2.py, they aren't found.

Is there a way to do this without re-writing the image with Apptainer?

0

There are 0 best solutions below