Installing FEniCS in Ubuntu

Hi,
I’m new to FEniCS and had a few doubts and required a few confirmations about the questions below.
As far as I understood, to install FEniCS on Ubuntu, there are 3 methods:

  1. Use the Ubuntu PPA binary packages and install using the apt package manager.
  2. Use the debian version of Dolfinx and use apt.
  3. Install Docker and using the Docker images to run the container.

Please correct me at this point if I am wrong.

I have personally tried method 3 and have the run the container for the Jupyter notebook as per the original FEniCS tutorial page and got it to work. My doubt now lies in what happens when the normal container or image is used. Does the container basically produce a local version of the build which I can then access? If so, how do I access it?

As in, if I wanted then to write a program from scratch which uses Dolfinx and all its dependencies on a file inside a folder somewhere on the desktop would that be possible and how? If not, should I be doing something like linking the folders of the container and my working directory somehow…

Finally, would the dolfinx container need to be running when I am writing my program or only during any compilation?

Thanks in advance :slight_smile:

There are quite a few more options, as highlighted in GitHub - FEniCS/dolfinx: Next generation FEniCS problem solving environment

I would suggest having a look at:

You can start and stop a container with a name by calling docker container start -i name_of_container docker container stop name_of_container

1 Like

Hi dokken,
Thank you for your reply.
The question that you forwarded me to is showing how to open a Jupyter notebook image of FEniCS right? Using the command:
sudo docker run -ti -p 8888:8888 -v $(pwd):/root/shared -w /root/shared --name=dolfinx dolfinx/lab:v0.6.0-r1

I wanted to know how to just use the dolfinx image locally (not the Jupyter lab one) and run some local editor in a directory of my liking. Would that be done using the following command:
docker run -ti -v $(pwd):/root/shared -w /root/shared --name=dolfinx_stable dolfinx/dolfinx:stable

Here, --name is done to ensure that our working directory remains the same each time? i.e. our files won’t disappear when we close and restart the container?
Also I wanted to clarify what the -v and -w options do. As I far as I read that -v is used to mount the directories of the docker image to ‘pwd’ which is our current directory and -w is used to set it up as the working directory. However, I do understand what it does exactly.

Thanks again!

The -v and -w does not change the context when changing image. These images simply have different entry points (and the lab images has some additional dependencies to run jupyter-lab).

If you do not use name when you do run docker creates a container with a random name sharing the directories with the docker container. This does not mean that your files created and executed in /root/shared in the container will disappear when you close the container, but you will keep using memory creating new containers. -w set the working directory (this is just for convenience so you dont have to manually change to /root/shared once you have started the container), ref Docker run reference | Docker Docs

Thanks, I think I understood…!