Developping from Docker container?

I want to implement my application in Fenicsx. It is relatively complex and I expect that I’ll need to write some C++ code. Notably I want to write collision tests with elements of the mesh and I would do it through CGAL.

Some of the Dolfinx dependencies conflict with currently installed software on my machine. In particular I would need to have 2 PETSCs on my machine and would prefer to avoid that. So I am contemplating working through Docker. I am a beginner in both Fenicsx and Docker so I am usnure about feasibility.

Would you recommend developing Dolfinx code inside of a Docker container?

1 Like

I do all my development inside docker containers.
I use the docker image:
ghcr.io/fenics/test-env:current-mpich
to get the core dependencies (including petsc), and then install basix, ufl, ffcx and dolfinx on top of that.
The following gist has all commands I use for rebuilding:

including commands I add to .bashrc to rebuild dolfinx etc.

The easiest way to interact with Docker and local installations is by using vscode, as you can attach vscode to docker image, and browse the file-system of the docker container as if it was a local installation.

Another option is to use conda and rely on stable releases of DOLFINx, petsc etc, in an isolated conda environment.

2 Likes

Thank you! I am currently working my way through the gist you sent.

  1. What should be in /root/shared in the container? basix, ufl, ffcx, dolfinx folders from the local machines mounted using docker volumes ?
  2. Would this be the actual command to build dolfinx ?
rebuild dolfinx cpp python
  1. What is the compile_demo function for ?

Yes, that is the idea.

You can either use rebuild dolfinx cpp python or rebuild dolfinx clean cpp python to rebuild dolfinx (clean just removes previous build files first).
For building basix you can simply call basix, and for ufl and ffcx you ufl_ffcx to build it.

If you want to build the C++ demos, you can enter any demo and run this command to compile the demo code and variational forms.

1 Like