Acces to a file in a container

Hello,

I’m a new user in Docker and I’m trying to acces to the log of a docker container but I don’t know how to do.
Someone told me to see the log located in /var/log/kurento-media-server inside the kms docker container but I don’t understand how to do it.
Could you please help me?

Cheers,

docker exec -it containername bash will (usually) get you a shell in a running container, and from there, depending on what’s installed, you can read the logs.

I also find it useful to use bind-mounted host directories for config files and logs that external administrators will routinely need to use: docker run -v $HOME/logs/kurento:/var/log/kurento-media-server ... when you initially start the container.

Thanks it’s exactly what I was looking for.
I have a file recorded in a directory in a docker container. Is it possible to make so that he records outside the container docker?

Cheers,

Hi @erylis21,

Yes it is possible. Actually, the answer was in @dmaze post :wink:

docker run -v $HOME/logs/kurento:/var/log/kurento-media-server  

The files on your computer: $HOME/logs/kurento
Will match the container: /var/log/kurento-media-server
(and vice-versa, it’s a mount)

You can use as many -v flags as you’d like to mount files or directories: