How do you display logs of a docker container?
Experience Level: Junior
Tags: DockerDocker CLI
Answer
Run the following command to get a list of containers:
docker ps
Find the container you want to get logs from and get its ID.
Run the following command to display logs:
docker logs ContainerID
Related Docker job interview questions
How do you write a list of all running Docker containers to a file file.txt?
DockerDocker CLI JuniorHow do you run a docker image app1 in detached mode and name the container mycontainer1?
DockerDocker CLI JuniorHow do you send a locally build image img1 to a docker registry reg.local:5000?
DockerDocker CLIKubernetes JuniorHow do you tag a docker image img1:latest using a tag v12?
DockerDocker CLI JuniorWhat is container orchestration and why should we use it?
Docker Junior