9 Troubleshooting Tips
9.0.1 Tips for troubleshooting
First remind yourself of the lessons we discussed in the activities in Chapter 3:
Then ask yourself the following questions:
- Is there a file that I’m assuming the image/container has that it does not?
- Is there a software package I’m assuming the image/container has that it does not?
- Is there a typo?
- Am I missing a dependency? Make sure the dependency’s RUN steps come before the software package that needs it.
- If my docker image isn’t building is it because
- Did the base image I’m pulling from change or a file I’m
COPY
ing change? Do I need to use –no-cache to force a rebuild of everything so the changes are seen?
Now you have the basics of using containers but this is really just the beginning! As you continue to work with containers you will encounter errors and need to troubleshoot. This table has a quick rundown on some of the most common errors:
9.1 Activity Instructions
9.1.1 Docker
There are three Dockerfiles in this folder. Each has something slightly wrong with it.
Use the following docker build
commands and work to pinpoint the error and fix it using the tips we discussed in this chapter.
9.1.1.1 Bad Dockerfile 1:
docker build -f Bad_Dockerfile_1 .
9.1.1.2 Bad Dockerfile 2:
docker build -f Bad_Dockerfile_2 .
9.1.1.3 Bad Dockerfile 3:
docker build -f Bad_Dockerfile_3 .
9.1.2 Podman
There are three Dockerfiles in this folder. Each has something slightly wrong with it.
Use the following podman build
commands and work to pinpoint the error and fix it using the tips we discussed in this chapter.
9.1.2.1 Bad Dockerfile 1:
podman build -f Bad_Dockerfile_1 .
9.1.2.2 Bad Dockerfile 2:
podman build -f Bad_Dockerfile_2 .
9.1.2.3 Bad Dockerfile 3:
podman build -f Bad_Dockerfile_3 .
9.2 SPOILERS: Hints for each of the dockerfiles
Bad_Dockerfile_1 hint
Carefully look at the name of base image that is being pulled from.Bad_Dockerfile_2 hint
Are the commands that are referenced all things that are installed on the base image?Bad_Dockerfile_3 hint
Is the file that is beingCOPY
over specified correctly?