Skip to content

Instantly share code, notes, and snippets.

@BinWang0213
Last active July 19, 2021 20:43
Show Gist options
  • Save BinWang0213/26093ceb6629e6560066fd1085298edb to your computer and use it in GitHub Desktop.
Save BinWang0213/26093ceb6629e6560066fd1085298edb to your computer and use it in GitHub Desktop.
Install Fenics in Docker

1. Show available containers 

sudo docker ps

2. Start container with shared root in local machine  $(pwd):/media/home/Fenics/ to container root  /home/fenics/shared 

docker run --shm-size=1g -ti --name notebook -w /home/fenics -v F:/fenics/run_examples:/home/fenics/shared -d -p 127.0.0.1:8888:8888 quay.io/fenicsproject/stable 'jupyter-notebook --ip=0.0.0.0'

docker run --shm-size=1g -ti --name fenics -v F:/fenics/run_examples:/home/fenics/shared quay.io/fenicsproject/stable

notebook usage

docker inspect notebook #find ip address ip:8888

3. Re-enter the container

sudo docker attach fenics

docker exec -u fenics -it fenics bash

4. Re-start the container

sudo docker restart fenics

5. Close a container

sudo docker stop fenics

6. Run fenics

python3 script.py

7. Run another terminal in one container

docker exec -ti notebook bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment