Firedrake
Firedrake is a finite element software.
Pull a docker image
There are images for both x86 and arm.
docker pull firedrakeproject/firedrake:latest
Start a container
docker run -it --name firedrake -p 8888:8888 \
-v $(pwd):/root/shared -w /root/shared \
firedrakeproject/firedrake:latest
If you want to create your own docker image, then read on. These instructions do not seem to work correctly now. You will need to use an ubuntu image instead of debian. Even then I had trouble compiling.
Install inside a docker image
Firedrake does not provide a Docker image for arm, so we build it ourselves.
Pull Debian image
docker pull debian:stable
Start it
docker run -it --name debian debian:stable
Inside the container, run the commands
cd ~
apt update
apt upgrade
apt install wget vim
wget https://github.com/cpraveen/cfdlab/raw/refs/heads/master/bin/firedrake_debian.sh
bash ./firedrake_debian.sh
You can read the commands here.
Add some settings in ~/.bashrc file
PS1="$ "
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PROMPT_COMMAND='echo -ne "\033]0;@docker:${PWD/$HOME/\~}$(parse_git_branch)\007"'
export LS_OPTIONS='--color=auto'
alias ls='ls $LS_OPTIONS'
export OMP_NUM_THREADS=1
export VIRTUAL_ENV_DISABLE_PROMPT=1
. /root/firedrake/bin/activate
Subsequently, if you exit the container, you can start and attach to it like this
docker start debian
docker attach debian
Activate the env if not already done
. /root/firedrake/bin/activate
Now you can run firedrake programs inside the container.
Create an image
Create an image called firedrake out of the debian container.
docker commit debian firedrake
cd to the directory you want to share with the container (dont do this from your HOME directory) and run the firedrake image (it likely has tag latest)
docker run -it --name firedrake -p 8888:8888 \
-v $(pwd):/root/shared -w /root/shared \
firedrake:latest
That directory will now be accessible inside the container at /root/shared.
You can start jupyter inside container
. /root/firedrake/bin/activate
jupyter-lab --ip 0.0.0.0 --port 8888 --no-browser --allow-root
and access it from the host at displayed url. Subsequently you can join this container
docker start firedrake
docker attach firedrake
Publish image to dockerhub
You can also upload the firedrake image to your docker hub and you can use it from another computer and others can also use it.
docker tag firedrake:latest cpraveen/firedrake:latest
security unlock-keychain
docker login -u cpraveen
docker push cpraveen/firedrake:latest
You can see the image in my docker hub. Since I have a free account, images may get deleted after some days.
Using my image
You can pull my image
docker pull cpraveen/firedrake:latest
and run it
docker run -it --name firedrake -p 8888:8888 \
-v $(pwd):/root/shared -w /root/shared \
cpraveen/firedrake:latest