Had a ... fun thing happen in GitHub Actions today where my tests were starting before the MySQL server they needed was up and running. MySQL in this case was running in Docker compose. So I started my process with a little shell script using mysqladmin: #!/usr/bin/env bash count=0 alive="no" while [ "$count" -lt 5… Continue reading Waiting for MySQL to be Ready in Docker Compose
Category: Docker
Docker Compose Exec on Github Actions
Just hit this error running a Github Action that used docker compose exec ...: the input device is not a TTY Github actions doesn't give you a true terminal or shell (input/output environment, a TTY) and docker compose exec by default does, essentially, docker exec -it ... where -i means interative and -t is run… Continue reading Docker Compose Exec on Github Actions
How to Connect to the Host Machine from a Container on Docker for Mac
I was recently working on a mac-based dev environment and need to proxy from a container running nginx (to handle HTTPS connections) to a server running on the host machine. Docker's host network mode does not work on MacOS as expected given that docker is running inside a VM rather than directly in the host's… Continue reading How to Connect to the Host Machine from a Container on Docker for Mac
One Way to Manage Secrets in Dockerized Applications
Putting configuration in the environment is a fairly well acknowledged best practice now. That configuration often includes secrets. But environment variables in container images -- like the docker ENV stanza -- are not really secure. They are built as part of the image, after all, so anyone with access to the image can get at… Continue reading One Way to Manage Secrets in Dockerized Applications
Multi-Stage Docker Builds for PHP Applications
The neatest thing I've discovered about Docker in the last few months are multi-stage builds. To put it simply a multi-stage build is a Dockerfile with two or more FROM stanzas. Let's explore what that means for a PHP project. First, a goal: the images built for any application should 100% ready to go. That… Continue reading Multi-Stage Docker Builds for PHP Applications