When building images, the content of /tmp will not make it into the image. The folder mounts a disposable tempfs volume, which gets removed. Use a different path and you should be good.
It does not seem to be true. I wasn’t sure so I tried and my file remained in /tmp even inside the container. Tried on MacOS and Ubuntu Linux hosts
And also:
.
@alexev275 Try to add set -eux -o pipefail to your startup script right after #!/bin/bash
It should fail if the files are not there and not instead of starting the daemon.
#!/bin/bash
if [ -z $RPC_PASSWORD ]; then
echo “Need to set env RPC_PASSWORD”
exit 1
fi
sed -i “s/{{RPC_PASSWORD}}/$RPC_PASSWORD/g” /tmp/daemon.conf
cat /tmp/daemon.conf
cp /tmp/daemon.conf /root/.daemon/daemon.conf
cat /root/.daemon/daemon.conf
exec daemond -conf=/root/.daemon/daemon.conf
This is for debugging only t see where the script stops. After that you can remove “x” but keep set -eu -o pipefail or at least set -eu
If the image contains the files then it is possible that have an entrypoint which clears the /tmp folder. It could also be caused by mounting an empty volume or using “tmpfs” for your containers any volime or tmpfs definition in your command.
There may be a way that I am not aware of to make /tmp to be on tmpfs by default so run “df” in your container to see if /tmp is on tmpfs. You can lalso try to override the entrypoint when you start the container to check the files:
docker run --rm --entrypoint "" containername ls -l /tmp