Requirement: I am trying to mount a volume from Host to a docker container(/var/log) so that all the log files for this particular container is written to the Host volume. The basic idea is to have all the logs written by the container instance is persisted and can be read.
I have a debian docker image running on Ubuntu 18.04
What I did:
- Create a folder /root/dockerlogs in the Host system
- Start the container using the below command
docker run -d -v /root/dockerlogs:/var/log debian
Ouput of “docker ps -a” after running the above command is as below:
CONTAINER ID IMAGE COMMAND STATUS
qbbaafffaab8 debian “bash” Exited (0) 2 minutes ago
Any idea or a workaround is appreciated.