09 Trubleshoot running container

Shell

When trubleshooting a running container, a cli inside the container, is often a usefull tool. We will try this in the following steps

docker exec -it nginx /bin/bash
ls /usr/share/nginx/html
exit
docker ps

Logs

Getting logs from a running container, is also a usefull way of trubleshooting, without loogin into it.

docker logs nginx
ubuntu@student-0:~/ops2devops/3.Docker$ docker logs nginx
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2022/04/19 07:27:02 [notice] 1#1: using the "epoll" event method
2022/04/19 07:27:02 [notice] 1#1: nginx/1.21.6
2022/04/19 07:27:02 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 
2022/04/19 07:27:02 [notice] 1#1: OS: Linux 5.13.0-1021-aws
2022/04/19 07:27:02 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2022/04/19 07:27:02 [notice] 1#1: start worker processes
2022/04/19 07:27:02 [notice] 1#1: start worker process 32
2022/04/19 07:27:02 [notice] 1#1: start worker process 33
188.179.193.131 - - [19/Apr/2022:07:27:10 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
188.179.193.131 - - [19/Apr/2022:07:27:10 +0000] "GET /Devops-toolchain.svg.png HTTP/1.1" 304 0 "http://35.159.25.103/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"