Skip to content

Debug Docker image during building process

Rui Wang edited this page Jun 5, 2024 · 1 revision

We can try running some commands while building the docker image.

For example, we want to see if we have certain files in a directory:

We add some commands on Dockerfile.api

# TODO: Debug
RUN echo "Debug runner stage:"
RUN pwd
RUN ls -lat
RUN ls -lat /app
RUN ls -lat /app/apps/api/src/helpers/mappers/la/person/

and then, run command below to build the image with the name hono-api-debug as an example:

docker build . -t hono-api-debug -f Dockerfile.api --progress=plain --no-cache

After the we are done with debug, we can remove the image by, eg.:

docker image rm hono-api-debug