|
|
<!-- --- title: Precompiled Packages (docker) -->
|
|
|
|
|
|
[![home](/icons/home.svg "wiki home")](/home)
|
|
|
[![packages](/icons/package.svg "packages")](/precompiled)
|
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
![debian](/icons/docker.svg "Docker")
|
|
|
|
|
|
## Precompiled packages - Docker
|
|
|
|
|
|
OpenCFD Ltd. uses [Docker Hub](https://hub.docker.com/) to distribute
|
|
|
pre-compiled versions of OpenFOAM for Linux, Mac OS X and Windows,
|
|
|
including a complete development environment.
|
|
|
|
|
|
Docker containers enable binaries compiled on a given Linux environment to
|
|
|
be run on other platforms without any performance degradation. Docker also
|
|
|
operates on Windows and Mac OS X wrapped in a light-weight Virtual Box.
|
|
|
|
|
|
An image of OpenFOAM contains binaries and source code. The Docker environment provides:
|
|
|
- A complete development environment to compile local modifications and create executables.
|
|
|
- consistent behaviour of the OpenFOAM across all platforms
|
|
|
|
|
|
Check if your (Linux or Windows or Mac OS X) system is supported by visiting
|
|
|
https://docs.docker.com/engine/installation/
|
|
|
|
|
|
|
|
|
### Installing Docker
|
|
|
|
|
|
Docker is available in a Community Edition (CE) and an Enterprise Edition
|
|
|
(EE). For installing and running the OpenFOAM image, the Community Edition is
|
|
|
sufficient.
|
|
|
Please see: https://docs.docker.com/engine/installation/
|
|
|
|
|
|
### Installing and running OpenFOAM
|
|
|
|
|
|
- Make sure the user is in the _docker_ group.
|
|
|
This can be checked with
|
|
|
```
|
|
|
$ id
|
|
|
```
|
|
|
The list of groups should include _docker_.
|
|
|
- Make sure the Docker daemon is running:
|
|
|
```
|
|
|
$ docker info
|
|
|
```
|
|
|
- Download the following scripts from the release instructions and put them
|
|
|
in a local directory (_eg_, your home directory)
|
|
|
- [installOpenFOAM][install-script]
|
|
|
- [startOpenFOAM][start-script]
|
|
|
- Make both scripts executable:
|
|
|
```
|
|
|
$ chmod +x installOpenFOAM
|
|
|
$ chmod +x startOpenFOAM
|
|
|
```
|
|
|
- Download and create the Docker container for OpenFOAM by executing the
|
|
|
first script:
|
|
|
```
|
|
|
$ ./installOpenFOAM
|
|
|
```
|
|
|
This only needs to be done once per login. The first invocation will
|
|
|
download the whole OpenFOAM installation so might take some time to finish.
|
|
|
Future invocations will only take a few seconds.
|
|
|
- Start the Docker container with the second script:
|
|
|
```
|
|
|
$ ./startOpenFOAM
|
|
|
```
|
|
|
- This will open a new shell with the OpenFOAM environment fully installed
|
|
|
and ready to use. For example,
|
|
|
```
|
|
|
mkdir -p $FOAM_RUN
|
|
|
run
|
|
|
cp -p $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity .
|
|
|
cd cavity
|
|
|
blockMesh
|
|
|
icoFoam
|
|
|
```
|
|
|
- All user files inside the Docker environment are available on the host inside
|
|
|
the home directory.
|
|
|
|
|
|
|
|
|
## Frequently Asked Questions about Docker
|
|
|
|
|
|
- <em>Is there any performance degradation when running via Docker?</em><br/>
|
|
|
Docker should run as fast as natively compiled code.
|
|
|
On Windows and Mac OS X there may be a slight performance penalty
|
|
|
associated with I/O.
|
|
|
- <em>How do I check if the OpenFOAM image has been downloaded correctly?</em><br/>
|
|
|
Type the command
|
|
|
```
|
|
|
$ docker images
|
|
|
```
|
|
|
to show the images available in Docker environment. For example,
|
|
|
```
|
|
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
|
|
openfoamplus/of_v2006_centos73 latest f37ab3b17c2d 2 months ago 2.98GB
|
|
|
...
|
|
|
```
|
|
|
If you receive an error message about not being able to contact the Docker
|
|
|
daemon check that:
|
|
|
- the Docker daemon is started at boot time
|
|
|
- the user account is in the _docker_ group (see output from the `id` command)
|
|
|
- <em>Where are my files?</em><br/>
|
|
|
The user files inside Docker are visible (_ie_, mounted) in your home area
|
|
|
and can be operated on just like any other file.
|
|
|
- <em>Why doesn't `paraFoam` display?</em><br/>
|
|
|
Make sure that your machine's software is fully up-to-date. See if you can
|
|
|
start a simple X-windows, non-graphics program (for example, `xterm`).
|
|
|
If this does not come up there may be a problem with the _xhost_ access to
|
|
|
the host screen. This is one of the steps inside the _startOpenFOAM_ script.
|
|
|
An alternative remedy is to install the native ParaView version for your
|
|
|
system, and use the built-in OpenFOAM reader and/or OpenFOAM data
|
|
|
conversion tools such as `foamToVTK`.
|
|
|
- <em>How do I run parallel?</em><br/>
|
|
|
Same as any other OpenFOAM installation, _e.g._: `mpirun -np 2 icoFoam -parallel`
|
|
|
- <em>How do I run parallel on multiple computers?</em><br/>
|
|
|
This is not trivial inside the Docker environment. Also you might want to
|
|
|
include optimised communication libraries (MPI) so it probably makes more
|
|
|
sense to [perform a native compilation](/building)
|
|
|
- <em>How do I compile code?</em><br/>
|
|
|
The Docker environment contains a full OpenFOAM development environment so
|
|
|
all `wmake`, `wclean` _etc._ commands work (it is running the actual
|
|
|
environment OpenFOAM was compiled in!)
|
|
|
- <em>What does installOpenFOAM do?</em><br/>
|
|
|
It downloads the OpenFOAM image from the Docker Hub and creates a
|
|
|
specialized container. This container
|
|
|
- mounts the home directory of the user with read/write access
|
|
|
- optionally channels the graphics
|
|
|
- sets up the OpenFOAM environment.
|
|
|
|
|
|
- <em>I still have questions...</em><br/>
|
|
|
The Docker route is being continually refined. It you have comments/tips
|
|
|
please mail them to: `docker (at) opencfd.co.uk`
|
|
|
|
|
|
|
|
|
## About the image
|
|
|
|
|
|
The current image was created from CentOS 7.3. If you wish to install any
|
|
|
additional tool in your docker container, start it as usual via the
|
|
|
_startOpenFOAM_ script, login as root with the password `ofuser2006` for the
|
|
|
OpenFOAM-v2006 version and use _e.g._ `yum`.
|
|
|
|
|
|
|
|
|
---
|
|
|
Copyright (C) 2020 OpenCFD Ltd.
|
|
|
|
|
|
[install-script]: https://sourceforge.net/projects/openfoam/files/v2006/installOpenFOAM
|
|
|
[start-script]: https://sourceforge.net/projects/openfoam/files/v2006/startOpenFOAM |