Docker is a tool every developer should use. It makes a lot easier to create a development environment. Actually, it makes easier to create many different environments in the same machine at the same time.
There is no turning back to the old style programming when you start using docker (or similar tools) in your project.
Well… I use docker for every project! Python, PHP, small tests, WordPress and many sites and services I have in production. It just works!
You probably know that already, right?
I was using docker to developer some WordPress plugins and make some theme customizations and when I tried to build an image with “docker-compose build” I was presented with the error message:
- How to find out the hosts in the known_hosts file? Even if encoded!
- Docker + VirtualBox on Windows 10
failed to build: max depth exceeded
This was my previous docker-compose.yml file that was causing the error.
What is causing this error?
Well… the problem is that I was using “build” and “image” at the same time and with this Dockerfile (below).
The Dockerfile is starting from image: wordpress:4.9.6-php7.2-apache … and writing the results to the same image, as specified in line 26 of the above docker-compose.yml.
Fixed: failed to build: max depth exceeded
In order to fix this issue, make sure that you are using an image name different from the one your Dockerfile starts from!
Otherwise, each build will add layers to your “final image” and you’ll end up with this max depth exceeded.
This error means that your image has too many layers.
This is the final docker-file.yml for my devel environment
Fixed: Docker build not using cache
Another side effect of this issue is that docker builds will always start from scratch as if you were asking to not use cache!
That is because you’re updating the initial image on every build. Simply does not update the image you are starting your build from!
Fix your docker-compose.yml file and your image builds will back to use cache and be fast again!
Sobre o autor
Super detailed animation on how a Black Hawk Helicopter works!
(RESOLVED) Can not authenticate to IMAP server: [ALERT] Please log in via your web browser
Docker exec not working inside cron! SOLVED
WordPress from PHP 5.6 to PHP 7.2! Better performance?