A simple script to log the docker console log in a file name “out.log” using the docker name
#!/bin/bash
echo $1
docker_sha=`docker ps | grep $1 | awk '{print $1}'`
if [ -z "$docker_sha" ]; then
echo "Invalid docker container name"
exit
fi
echo "$docker_sha"
docker logs $docker_sha >& out.log
0 Comments