command in docker run and inside docker not behaving similarly

I have script that load a database into RAM and print the adress of the first data into a file (db_REGISTER), and I want to run it inside a docker. This script works fine when it is launched inside a bash after launching the docker with -it

$ docker run -it --env-file $FILE -v $wkp:/app dev_machine
$$ /app/scripts/loadBase.sh

db_REGISTER

<some random number>

However when I launch the same script with docker run directly, the script works but the adress printed is always 0, and I cannot use the database afterward.

$ docker run -it --env-file $FILE -v $wkp:/app dev_machine /app/scripts/loadBase.sh

db_REGISTER

0

Does that mean that the second command does not have access to a persistant adress in the RAM ? What should I do to correct that ?

EDIT : After some advice, I tried to tweak the --ipc setting. Using --ipc="host" made it work. I guess this was a problem of shared RAM

1 answer

  • answered 2018-07-12 08:14 Mornor

    You could try to mount your file inside the Docker container before executing the command:

    docker run -it --env-file $FILE -v $PWD/scripts:/t -w /t dev_machine loadBase.sh