Containers That Won’t Start

The first thing to do is to check the Docker logs. First, get the ID for the container by using the “–a” flag to list all containers, including stopped containers as shown:

docker ps –a

Once you have the image ID, view the logs by typing

docker logs <id>

If the answer isn’t immediately obvious, you can connect to the container directly as we discussed earlier in the chapter by overriding the container’s entrypoint in the Docker run command as shown below:

docker run –t -i -p 80:80 --entrypoint=/bin/bash thedanfernandez/ productcatalog

This snippet replaces the “–d” (detached) flag with the “–i” flag to run interactively and overrides the Dockerfile entrypoint to instead start the bash ...

Get Microservices with Docker on Microsoft Azure™ (includes Content Update Program) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.