I'm a guy who enjoys creating WordPress designs for my real estate sites. Recently, I decided to try something new and move away from developing locally with Laravel Valet, opting instead to dive into Docker after reading up on it. I've managed to set up a working Docker container but I'm unsure if it's excessively complicated or if there's room for improvement. I'm hoping for some feedback on my setup! Here's my docker-compose.yaml file:
3 Answers
I agree with the previous suggestions! It's better practice to keep sensitive environment variables out of your compose file. If it's just for local development, you can pull these variables from your host environment. For example, use syntax like `MYSQL_DATABASE: ${DATABASE_NAME}`. This way, you can safely share your compose file without exposing secrets. You can also utilize a local .env file for convenience—you just need to remember to add this file to .gitignore to avoid accidental commits.
Just a quick note for clarity, this isn't technically a 'Dockerfile'; it's a docker-compose file. A 'Dockerfile' is specifically for building container images. But don't worry, it's easy to mix them up as they're closely related!
I have a few thoughts! First, try not to store sensitive information, like passwords, directly in your compose file. It's safer to omit specific tags like 'latest' from your images; using specific version tags can help avoid unexpected changes. Also, make sure your 'depends_on' is functional by adding a health check to ensure everything starts properly before your services run. And don’t forget, consider upgrading from MySQL 5.7 if you haven't yet!
Related Questions
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically
[Centos] Delete All Files And Folders That Contain a String