View Issue Details

IDProjectCategoryView StatusLast Update
0003423OpenFOAMBugpublic2020-01-23 14:06
ReportermarkrmauAssigned Towill 
Status closedResolutionno change required 
Platformopenfoam/openfoam7-paraview56OSdocker containerOS Version(please specify)
Product Version7 
Fixed in Version 
Summary0003423: Cannot run command in container from host
DescriptionHello, apologies if this is my error. I am trying to start the docker container and run a command.

docker run -ti --rm -e DISPLAY= -u0 -u 1000:1000 -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/elm/OpenFOAM/elm-7:/home/openfoam -e XAUTHORITY=/home/openfoam/.Xauthority -v :/home/openfoam/.Xauthority openfoam/openfoam7-paraview56 ./mm

Ideally the "openfoam7-linux" script would be updated to include an option for running a command.

Many thanks!

Steps To Reproduce1. Create /home/elm/OpenFOAM/elm-7
2. cd /home/elm/OpenFOAM/elm-7
3. create file mm with the following text:
echo 'Bite me' > ~/mm2.txt
4. chmod 744 mm
5. Run with
docker run -ti --rm -e DISPLAY= -u0 -u 1000:1000 -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/elm/OpenFOAM/elm-7:/home/openfoam -e XAUTHORITY=/home/openfoam/.Xauthority -v :/home/openfoam/.Xauthority openfoam/openfoam7-paraview56 ./mm

Additional InformationDocker version 19.03.5, build 633a0ea838 (have also tried version 18)
Tried on 2 different host machines. (one running debian testing, one running debian stretch).
Tried openfoam/openfoam7-paraview56 and an openfoam6 container.

Tried removing the -ti, removing -rm. Tried adding sleep 5 after the echo line in mm.

I looked at in root of the container and the last exec line seems to be correct but does it get the command from docker?

If I type
exec /bin/bash mm

in the running container the script runs correctly and the container exits.

If I try a completely different container (not from things work as expected.
TagsNo tags attached.



2020-01-08 08:55

reporter   ~0011048

Have decided to keep the container running.

So will start with openfoam7-linux

And will run processes by finding conatiner id with:
docker container ls

Then exec script with:
docker exec -it $CONTAINER_ID /home/openfoam/mm


2020-01-23 14:06

manager   ~0011099

Not a bug. The entry script is designed to launch an interactive shell. You can't pass non-interactive commands to it.

If you want to run the instance with a command, just bypass the entry script alltogether. Add "--entrypoint ./mm" to your launch command instead of just "./mm".

Issue History

Date Modified Username Field Change
2020-01-07 21:16 markrmau New Issue
2020-01-08 08:55 markrmau Note Added: 0011048
2020-01-23 14:06 will Assigned To => will
2020-01-23 14:06 will Status new => closed
2020-01-23 14:06 will Resolution open => no change required
2020-01-23 14:06 will Note Added: 0011099