Customize OpenFOAM v8 Docker Image on Mac

Introduction

Here is a summary of how to customize the image after installing OpenFOAM v8 (Foundation version) on Mac. For details such as installation, click here Qiita page and here cfdengine page -install-openfoam-anywhere-with-docker /) may also be helpful.

Docker installation

Download and install Docker Desktop from the Docker site. There is nothing special to mention here ... (It's easy, isn't it?).

After the installation is complete, start Docker Desktop. A whale mark will appear in the upper right corner like this.

Screen Shot 2020-10-17 at 23.41.46.png

Installation of OpenFOAM v8

Install according to Foundation in Foundation. Create a directory called ʻopenfoam` and type the following command in it.

Excerpt from the head family


sudo curl --create-dirs -o /usr/local/bin/openfoam8-macos http://dl.openfoam.org/docker/openfoam8-macos
sudo chmod 755 /usr/local/bin/openfoam8-macos

OpenFOAM container

By executing the following command (script) in the ʻopenfoam` directory, the OpenFOAM environment will be started.

openfoam8-macos

You can now use blockMesh and solvers.

Image customization

First, check the ID of the image.

docker images

Screen Shot 2020-10-16 at 22.37.49.png

Make a note of this Image ID. After that, launch Image as root.

docker run -it -u=root <Image ID>

If you start it with a script, it will not be recorded even if you install the application with apt etc. However, when started as root, customizations and various setting changes are recorded in the container. In this state, install your desired application.

After that, stop the container (log out) and check __Container ID __.

docker ps -a

Commit the modified container to the image.

docker commit <container ID> <Repository>

Although it is Repository, it is better to use the default setting and set it to ʻopenfoam / openfoam8-graphical-macos. You can change the Repository to whatever you like here, but you'll need to modify DOCKER_IMAGES in the startup script / usr / local / bin / openfoam8-macos`.

For example, if you want the Repository to be openfoam8,

example


docker commit <container ID> openfoam8

openfoam8-macos


DOCKER_IMAGE='macos8' 

will do.

Personally, I think it would be convenient to include lv, gmsh, python3.8,python3-pip (numpy, pandas, torch, tensorflow, scikit-learn). [^ 1] This is the end of customization. Thank you for your hard work.

[^ 1]: When installing torch, an event occurred that could not be installed due to an error like the one in here. Download torch directly from here and install it directly with pip3 I can do it. Alternatively, you can resolve it with pip --no-cache-dir install torch.

Finally

I couldn't find a site or page that summarizes how to customize the Docker image of OpenFOAM, so I summarized it here. I still don't understand how to use Docker, and sometimes I haven't used it up yet, so I don't know if it's the best way to do it ... I would be grateful if you could point out a better way.

Recommended Posts

Customize OpenFOAM v8 Docker Image on Mac
Install OpenFOAM v2006 on CentOS
Install openjdk8 on Docker image (Debian)
Steps to run docker on Mac
Try using Redmine on Mac docker
Deploy Flask's Docker image on Heroku
Use Docker on your M1 Mac
Publish Docker Image on GitHub Package Registry
Run Ubuntu + ROS with Docker on Mac
Liberty on Docker
Run mysql image on M1 MAC (Apple Silicon)
Update container image with KUSANAGI Runs on Docker
Redmine on Docker
When Kubernetes doesn't start on Docker Desktop for Mac
Install gradle on mac
Install Java on Mac
Docker installation on CentOS 6
Enable Docker BuildKit (mac)
python notes on docker
Tomcat v8 on CentOS7
Install Docker on Manjaro
Delete unused docker image
Jetty v8 on CentOS7
Install openjdk11 on mac
M.S. docker on Windows
Install OpenJDK 8 on mac
Docker installation on WSL2
Run phpunit on Docker
Until you start nginx on CentOS using Docker on Mac OS
Until you run Quarkus and run docker image on Amazon ECS
A story about speeding up unittest on Docker for Mac
Docker login not possible on remote Mac (Error saving credentials)
I tried running WordPress with docker preview on M1 Mac.
The story of setting up an Oracle V $ -like thing from 0 on PostgreSQL: 12 of the official Docker image