Public | Automated Build

Last pushed: a year ago
Short Description
Image based on Openfoam plus 3.0 using rhel66. Perfect to use with docker compose and docker swarm.
Full Description


OpenFOAM is a free, open source CFD software developed primarily by OpenCFD Ltd since 2004, distributed by OpenCFD Ltd and the OpenFOAM Foundation. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to acoustics, solid mechanics and electromagnetics.

Single Instance

Use ( or you can play with:

user="$(id -u)"

$ docker run  -it -d --name ofoam \
    --user=${user} \
    -e USER=${username} -e QT_X11_NO_MITSHM=1 \
    -e DISPLAY=${displayVar} --workdir="${home}" \
    --volume="${home}:${home}" \
    --volume="/etc/group:/etc/group:ro" \
    --volume="/etc/passwd:/etc/passwd:ro" \
    --volume="/etc/shadow:/etc/shadow:ro" \
    --volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
    -v=/tmp/.X11-unix:/tmp/.X11-unix \
    carlochess/of_v30plus_rhel66 \
    /bin/bash --rcfile /opt/OpenFOAM/OpenFOAM-v3.0+/etc/bashrc

You can attach whenever you want using

$ xhost +local:ofoam
$ docker start  ofoam
$ docker attach ofoam


$ mkdir -p $FOAM_RUN
$ run
$ cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity .
$ cd cavity
$ blockMesh
$ icoFoam
$ paraFoam

Local cluster (Docker compose)

Install Docker Compose (

You can use this docker-compose.yml

version: "2"

    image: carlochess/of_v30plus_rhel66
    command: "/bin/bash --rcfile /opt/OpenFOAM/OpenFOAM-v3.0+/etc/bashrc"
    user: "mpirun"
    working_dir: /app
    stdin_open: true
    tty: true
        - USER="mpirun"
        - QT_X11_NO_MITSHM=1
        - DISPLAY=:0
        - .:/app

An then apply this command. Notice that the user in the container is mpirun with
the password mpirun. Also the root user has password mpirun.

# Maybe you should run "docker-compose up -d" , first
$ docker-compose scale mpi_head=2

Assuming that you run the above command on the folder called openfoam, this is the result

Creating and starting openfoam_mpi_head_1 ... done
Creating and starting openfoam_mpi_head_2 ... done

You can attach to an instance by running

$ docker attach openfoam_mpi_head_1

Check connectivity with other containers by

$ ping openfoam_mpi_head_2
$ ssh openfoam_mpi_head_2

If wverything goes well,

$ cp -r /opt/OpenFOAM/OpenFOAM-v3.0+/tutorials/multiphase/interFoam/laminar/damBreak/ .
$ cd damBreak
$ cp -r 0/ 0/alpha.water
$ blockMesh
$ setFields
$ decomposePar
$ mpirun --host openfoam_mpi_head_1 openfoam_mpi_head_2 -np 4 interFoam

Docker compose + Docker Swarm

  • You need a docker swarm cluster, use a discovery backend (consul), a docker registry,
  • Maybe you need distribuited file system like nfs.


  • mpiuser
Docker Pull Command

Comments (1)
a year ago

Interesting . Whether i could use two machine with it and run a parallel program i.e run openfoam using 2 processor of 1 machine and 2 of other machine