Slide 1
Most trusted JOB oriented professional program
DevOps Certified Professional (DCP)

Take your first step into the world of DevOps with this course, which will help you to learn about the methodologies and tools used to develop, deploy, and operate high-quality software.

Slide 2
DevOps to DevSecOps – Learn the evolution
DevSecOps Certified Professional (DSOCP)

Learn to automate security into a fast-paced DevOps environment using various open-source tools and scripts.

Slide 2
Get certified in the new tech skill to rule the industry
Site Reliability Engineering (SRE) Certified Professional

A method of measuring and achieving reliability through engineering and operations work – developed by Google to manage services.

Slide 2
Master the art of DevOps
Master in DevOps Engineering (MDE)

Get enrolled for the most advanced and only course in the WORLD which can make you an expert and proficient Architect in DevOps, DevSecOps and Site Reliability Engineering (SRE) principles together.

Slide 2
Gain expertise and certified yourself
Azure DevOps Solutions Expert

Learn about the DevOps services available on Azure and how you can use them to make your workflow more efficient.

Slide 3
Learn and get certified
AWS Certified DevOps Professional

Learn about the DevOps services offered by AWS and how you can use them to make your workflow more efficient.

previous arrow
next arrow

How to troubleshoot Docker Server(daemon) and Containers?

Spread the Knowledge

How to troubleshoot Docker Server(daemon) and Containers?

There are following way using troubleshooting of Docker Server and Containers can be done. If you are running your container in -d (detached mode) or by docker remote API, you will not see any logs in console. To access running docker image or container logs you need to use docker logs command.

Docker Containers Logs

The docker logs command shows information logged by a running container.

[code]$ docker logs cont-id
$ docker container logs cont-id
$ docker logs –details CONTAINER
$ docker logs [OPTIONS] CONTAINER
$ docker container logs [OPTIONS] CONTAINER
$ docker help logs
# To follow docker log output or tail continuously
$ docker logs –follow ContainerName/ContainerID

# To see last n lines of logs
$ docker logs –tail 2500 ContainerName/ContainerID

# To see logs since particular date or timestamp
$ docker logs –since 2017-05-03 ContainerName/ContainerID[/code]

The docker service logs command shows information logged by all containers participating in a service.

[code]$ docker service logs[/code]

  • If you use a logging driver which sends logs to a file, an external host, a database, or another logging back-end, docker logs may not show useful information.
  • If your image runs a non-interactive process such as a web server or a database, that application may send its output to log files instead of STDOUT and STDERR.

Docker Events from Docker Server

To get real time events from the server, we can docker events commands. Information can include historical information and real-time information.

[code]$ docker events[/code]

Docker containers will report the following events:
attach, commit, copy, create, destroy, detach, die, exec_create, exec_detach, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update

Docker images report the following events:
delete, import, load, pull, push, save, tag, untag

Docker volumes report the following events:
create, mount, unmount, destroy

Docker networks report the following events:
create, connect, disconnect, destroy

Docker Daemon Logs

Docker daemon log depends on your OS. Here are the few locations, with commands for few Operating Systems:

  • Ubuntu (old using upstart ) – /var/log/upstart/docker.log
  • Ubuntu (new using systemd ) – sudo journalctl -fu docker.service
  • Boot2Docker – /var/log/docker.log
  • Debian GNU/Linux – /var/log/daemon.log
  • CentOS – /var/log/daemon.log | grep docker
  • CoreOS – journalctl -u docker.service
  • Fedora – journalctl -u docker.service
  • Red Hat Enterprise Linux Server – /var/log/messages | grep docker
  • OpenSuSE – journalctl -u docker.service
  • OSX – ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/log/d‌​ocker.log
  • Windows – Get-EventLog -LogName Application -Source Docker -After (Get-Date).AddMinutes(-5) | Sort-Object Time

If your OS is using systemd then you can view docker daemon log with:
$ sudo journalctl -fu docker.service

Using CentOS7, logs are available using the command
$ journalctl -u docker

For Docker Mac Native (without Boot2Docker or docker-machine, running your Docker installation without extra VirtualBox
$ syslog -k Sender Docker

Docker for Mac (Beta)
~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/log/d‌​ocker.log

Rajesh Kumar
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x