And found that it opens a new container (using the same volume) each time. This is not convenient if we need other dependencies (installing each time). I don’t understand why fenics choose to do that?
I did the same error initially when I started using docker. So let me explain briefly what you did.
The script curl -s https://get.fenicsproject.org gets the fenicsproject script (which you can check by copy-pasting the URL in the browser) and | bash executes the commands in bash terminal, thereby installing the fenicsproject script in the default directory which is ${HOME}/.local/bin. If this is present in your PATH variable, you should be able to execute the fenicsproject command on the terminal.
The fenicsproject run command then downloads the latest image of FEniCS and creates a container from that image. You can check the name of the container in docker ps -a (rename it if needed by docker rename old_name new_name and each time, instead of creating a new container use fenicsproject start container_name which runs the older container you created.
More information on fenicsdocker is ofcourse in the documentation here.