Docker
  • Docker Introduction
  • What is Docker?
  • Containers
  • Installation
  • Hello World app in PHP
  • Dockerfile
  • Building containers
  • Running containers
  • Volumes
  • Inspecting containers
  • Docker Hub
  • Docker Compose
  • Contact Us
Powered by GitBook
On this page
  • Logs
  • Docker exec

Inspecting containers

PreviousVolumesNextDocker Hub

Last updated 7 years ago

Logs

Containers running in the background almost always have applications that output some information to logs. This output is captured by Docker by default. This information can be viewed with the docker logs command.

 docker logs <containerIdOrName>

It is also possible to keep the log open. Any new additions to the log will be appended in real time to the terminal. This can be achieved with the -f or --follow attribute in the command.

 docker logs <containerIdOrName> --follow

Docker exec

Even when a container is running in the background, it is possible to execute commands inside that container. A popular command is bash. This effectively launches a shell process and enables you to view and interact with the container. You could compare this with an SSH session into the container.

docker exec -it <containerIdOrName> bash

docker logsDocker Documentation
docker execDocker Documentation
Logo
Logo