I'm trying to have my container log into /var/log/app
, a directory on the host machine. Unfortunately, changes made in the container are not being persisted, for example:
1 - start a container
sudo docker run -v /var/log/app --entrypoint bash -t -i b18bf31c48d5
2 - echo some file
echo "foo" > /varlog/app/foo.txt
3 - exit the container
4 - go check /var/log/app
for foo.txt
it's not there.
Any idea why this happens?
The problem was with the -v flag, this seems to make it work:
sudo docker run -v /var/log/app:/var/log/app:rw --entrypoint bash -t -i b18bf31c48d5