Installing FEniCS in Ubuntu

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