Extracting logs from docker gateway

Document ID : KB000118418
Last Modified Date : 24/10/2018
Show Technical Document Details
Question:
Since docker containers are stateless (info is not saved if it is stopped, for example), what is the recommendation for extracting the logs outside the container?

I am trying to mount a volume doing this in the docker-compose: volumes: - "/home/bs2cloud/gateway/log:/opt/SecureSpan/Gateway/node/default/var/logs/"

but it fails with the following error: java.lang.RuntimeException: The property logDirectory defined directory /opt/SecureSpan/Gateway/node/default/var/logs which is present but is not readable. Please ensure the Gateway is properly installed. Best.
Answer:
Log into the docker host and get the container ID of the SSG image
 

1. docker ps

docker ps

2. To copy a file the docker container to the host filesystemdocker cp <id>:/opt/SecureSpan/Gateway/node/default/var/logs/ssg_0_0.log /home
 
This will copy the ssg log from the Gateway container to the /home directory on the docker host

docker cp 


If you want to get into the docker container to explore the filesystem, run this
 
docker exec -it <ID> bash
 
It will get  a bash shell. ID = the container ID from step 1

View