|
[Sponsors] |
[OpenFOAM.com] IcoFoam not found in docker when executed from outside |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 14, 2021, 10:29 |
IcoFoam not found in docker when executed from outside
|
#1 |
Member
Sunag R A
Join Date: Jul 2019
Location: Bangalore, India
Posts: 82
Rep Power: 7 |
Dear all,
I wanted to run OpenFOAM simulation inside docker container, for this I have built the docker image from dockerfile. The dockerfile has Openfoam 5 installation along with necessary requirements. 1. When the image is built, OpenFOAM works perfectly when I enter into the container and test with "icoFoam" command. 2. But, when I exec it with "CMD" inside dockerfile, it throws an error stating "icoFoam not found". 3. All installation done with new user and not in root. Below is the dockerfile content. Code:
################################################################################### USER root # Install OpenFOAM5.0, paraviewopenfoam54 and PyFoam # Add dl.openfoam.org to the list of software repositories RUN sh -c "wget -O - http://dl.openfoam.org/gpg.key | apt-key add -" # Install the dependancies (Can also have a requirements file and build from there) RUN apt-get install software-properties-common -y RUN add-apt-repository http://dl.openfoam.org/ubuntu RUN apt-get install apt-transport-https -y RUN apt-get update -y RUN apt-get -y install openfoam5 # New user creation RUN groupadd -r sunag && useradd -m -r -g sunag sunag # Source bashrc RUN echo "source /opt/openfoam5/etc/bashrc" >> /home/sunag/.bashrc USER sunag # Install pip packages for specific user RUN python -m pip install --user numpy scipy pandas scikit-image opencv-python PyFoam open3d numpy-stl gunicorn WORKDIR /home CMD icoFoam So, what am I missing here or what work around needs to be done? Hope, it is understood. Regards, Sunag R A. |
|
October 15, 2021, 16:22 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
If you are running CMD, I don't know that you will have all scripts setup properly. For this we use a backend dispatch script to relay things through. See the packaging files.
https://develop.openfoam.com/packaging/containers For example, if you even just grab the start script as described here: https://develop.openfoam.com/Develop...ompiled/docker And use the 'openfoam-docker' script. For example, Code:
$ openfoam-docker / icoFoam -help
EDIT: forgot the mention there is also a 'openfoam-docker -podman' option if that is your preference. |
|
October 19, 2021, 12:37 |
|
#3 |
Member
Sunag R A
Join Date: Jul 2019
Location: Bangalore, India
Posts: 82
Rep Power: 7 |
Dear oselen,
Thank you for your reply. With respect to the links you have shared, I actually wanted openfoam v5 only since all the files are created according to that. And, as per the dockerfile contents, all the installation is perfect since openfoam works inside the container without any issues. Is there any work around other than the ones you have mentioned? Like, since the error says Code:
/bin/sh/:1:icoFoam not found I do not want to enter the container and run the OpenFOAM simulations, since I will using flask code to get requests from outside the docker, where the flask code has a function of another python file which contains all the OpenFOAM related python codes for simulation. So, I need it to work from CMD only. Regards, Sunag R A. Last edited by sunagra27; October 19, 2021 at 14:05. |
|
October 19, 2021, 19:33 |
|
#4 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
I can only offer help on the openfoam.com docker installation. The "v5" you mention is from somebody else. If using CMD instead of ENTRYPOINT is what you require for you application (although I honestly don't see what was wrong with my solution) you'll have to do that on your own. However, in the end you will likely discover that you need a similar mechanism to get your environment setup (within the container) as part of your dispatch. |
||
October 19, 2021, 19:36 |
|
#5 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
I'm not sure if you noticed that the docker solution that I mentioned can be used non-interactively. Did it not work for you? |
||
October 20, 2021, 07:08 |
|
#6 |
Member
Sunag R A
Join Date: Jul 2019
Location: Bangalore, India
Posts: 82
Rep Power: 7 |
Dear oselen,
There is nothing wrong in your solution. I wanted to work with Openfoam v5 and so dint give a work around with the other versions. I did solve it lately by adding all the ENV path to dockerfile which corresponds to Openfoam and now it is running perfectly. Excrept of dockerfile ENV addition Code:
ENV WM_PROJECT_INST_DIR /opt ENV FOAM_RUN /home/niramai/OpenFOAM/-5.0/run ENV ParaView_MAJOR 5.4 ENV WM_THIRD_PARTY_DIR /opt/ThirdParty-5.0 ENV WM_LDFLAGS -m64 ENV FOAM_APP /opt/openfoam5/applications ENV WM_CXXFLAGS -m64 -fPIC -std=c++0x ENV FOAM_UTILITIES /opt/openfoam5/applications/utilities ENV FOAM_APPBIN /opt/openfoam5/platforms/linux64GccDPInt32Opt/bin ENV ParaView_DIR /opt/paraviewopenfoam54 ENV WM_PRECISION_OPTION DP ENV FOAM_SOLVERS /opt/openfoam5/applications/solvers ENV FOAM_EXT_LIBBIN /opt/ThirdParty-5.0/platforms/linux64GccDPInt32/lib ENV WM_CC gcc ENV FOAM_USER_APPBIN /home/niramai/OpenFOAM/-5.0/platforms/linux64GccDPInt32Opt/bin Likewise, all the ENV were added. Regards, Sunag R A. Last edited by sunagra27; October 20, 2021 at 11:48. |
|
October 20, 2021, 15:58 |
|
#7 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
If you are defining the ENV yourself, you don't need most of those. Need WM_PROJECT_DIR so that OpenFOAM can find its etc/ content (eg, controlDict cellModels). Make sure that the value of FOAM_APPBIN is in the PATH and the value of FOAM_LIBBIN is in the LD_LIBRARY_PATH and that should be enough.
|
|
Tags |
cmd, docker, openfoam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[RapidCFD] Discussion thread on how to install and use RapidCFD | newoscar | OpenFOAM Community Contributions | 88 | May 17, 2024 10:39 |
error in fireFoam, when running the case wallFireSpread2D | zhoubiao1088 | OpenFOAM Running, Solving & CFD | 9 | February 1, 2018 19:45 |
[Other] Compiling hacFoam (Ubuntu 10.04)(OF2.0.0)(LAMMPS13Jul2010)) | Henrik_E | OpenFOAM Installation | 3 | September 29, 2016 17:16 |
OpenFOAM 1.7.1 installation problem on OpenSUSE 11.3 | flakid | OpenFOAM Installation | 16 | December 28, 2010 09:48 |
critical error during installation of openfoam | Fabio88 | OpenFOAM Installation | 21 | June 2, 2010 04:01 |