-3

I am trying to run a Python software on a windows system using Docker. For context, I am starting an internship in a couple of weeks during which I will be using the Python software OpenMC to model neutronics (https://docs.openmc.org/en/stable/). I believe the software was written for Linux, so to run on a windows machine, I need to go through Docker. For the life of me, I cannot get this to work.

The main issue is that I cannot figure out how to actually execute a Python script within this Docker container. The primary instructions for this specific software (OpenMC) are in the Quick-Installation instructions and the Developer's Guide, both linked here:

I am able to go through all the steps of the Developer's guide, but once I am in this "interactive shell" I don't understand how to execute a Python script that I've written on my machine. I've been stumped on this issue for the better part of a week, and could really use some guidance. I am verging on desperation here as I really need to get my feet wet with this software before I start working, and right now I can't even get it to run.

Thank you for your time, and let me know if I can clarify anything.

lcleary
  • 65
  • 6
  • Search for how to run python script inside Docker container. You need to `docker exec` into the container, and open the shell inside the container. – Gino Mempin Jun 28 '21 at 03:38
  • Does this answer your question? [Docker interactive mode and executing script](https://stackoverflow.com/questions/25101596/docker-interactive-mode-and-executing-script) – Gino Mempin Jun 28 '21 at 03:39
  • Python itself installs on multiple operating systems, and you might have better luck directly installing Python and running the program than trying to also add Docker into the picture. – David Maze Jun 28 '21 at 10:40
  • Figured this out. The key was to use an absolute filepath instead of a regular filepath on the volume mount, i.e. docker run -it --name=my_openmc1 --rm -v $pwd/path:/containerdir [image] instead of: docker run -it --name=my_openmc1 --rm -v path:/containerdir [image] – lcleary Jun 29 '21 at 01:14

1 Answers1

0

As mentioned above, I figured this out:

Figured this out. The key was to use an absolute filepath instead of a regular filepath on the volume mount, i.e.

docker run -it --name=my_openmc1 --rm -v $pwd/path:/containerdir [image]

instead of:

docker run -it --name=my_openmc1 --rm -v path:/containerdir [image]
lcleary
  • 65
  • 6