Entries with the tag “docker”
These entries are tagged with the “docker” tag. They will cover topics like Docker, Docker Engine, Docker Machine and Docker Compose.
When you start your Docker containers, the database container might be “running” before MySQL is actually ready to accept connections.
A healthcheck solves this by verifying the service inside the container is responsive.
I have npm installed globally on my machine.
But in some projects, I have a local ./npm script that wraps docker exec to run npm inside a container.
Docker provides the HEALTHCHECK instruction for Dockerfiles and Docker Compose files.
While not absolutely required, configuring these can make your IDE and environment more robust and verbose.
Here’s what I use with some common containers in Laravel projects.
Recently, I had an issue with PhpStorm not detecting my Docker configuration. I was using Docker Compose and everything worked fine with docker cli and Orbstack. Why wouldn’t PhpStorm recognize this? It’s a simple fix, actually. It has to do with the name of your project. Let me explain.
When using the Docker MySQL Container, you can specify files in the /docker-entrypoint-initdb.d folder to be imported or ran when the container is brought up. These can be in the form of .sql, .sql.gz or .sh - and get ran after the database is up but before its accepting connections.
But what if you can’t seem to get these to run again? The fix is just so annoyingly simple.
For the most part, I’ve containerized all of my dependencies inside of my Laravel projects. But, one thing was missing: npm.