Using OpenMC with Docker and Jupyter notebook

Hi,
In the last one month I tried every way to install OpenMC on windows and macbook as described in the users guide. I used both conda and from the source for Macbook. Able to use Jupyter lab and run examples. However, I bumped into a plotting issue and could not resolve the issue after trying several days ( read OpenMC forum to resolve - did not work), I had to quit.

I installed Docker on Windows now. However, since I am new in both in OpenMC and Docker I wanted to use with Python Notebook (new in that too). I run “docker run -it openmc/openmc:latest” but I stuck there. Don’t know how to reach Notebook. I have anaconda installed on my desktop somewhere but I don’t know how to reach from Docker.

I found a work around it. I downloaded Package neutronics-workshop · GitHub in Docker then I type

“docker run -p 8888:8888 Package neutronics-workshop · GitHub”. Using that link I can create another notebook for my problem andit runs perfectly fine. However, when I exit the link all my files are lost of course unless I download each time.

So…, how do I reach Jupyter notebook from Docker? I guess I have to install anaconda on docker as well, but where and how? After that how do I reach Jupyter notebook and run my problems.

Thank you for your help

Birsen

Dear Dr. Birsen,
I wonder if you was able to resolve the issues.

Can you describe which was the plotting issue in JupyterLab?

For the Docker, you can install JupyterLab in the container to use. To upload/download the your notebook to the container/local laptop, you can use:

  • To download
docker cp [CONTAINER]:/notebook ./destination/on/local/laptop

+To upload:

docker cp ./path/to/notebook [CONTAINER]:/destination

For the neutronics-workshop:
When you run “docker run”, it open a new container from the image, to open a previous container, you can use “docker start [CONTAINER]”

To see what containers that you’re having you can run:

docker ps -a

Have you considered using VS Code, it has extension that help working with Docker more convenient and user-friendly, it also support Jupyter Notebook

I hope you find this helpful, please let me know if there is anything I can help.

Son

You can mount your work directory with the Docker container using the -v option.

For example:

docker run -p 8888:8888 -v /path/to/your/workdir:/tasks -it ghcr.io/fusion-energy/neutronics-workshop

This command will map the /path/to/your/workdir on your local machine to the /tasks directory inside the Docker container. This way, any files or notebooks you create inside this directory will be saved on your local machine, so you won’t lose them when you exit the container.