Setting up a php developer environment using Docker

How do you setup a php developer environment using docker along with a database, and node since ill be doing a small practice fullstack project?
9 Replies
MD
MDOP12mo ago
I use devenv and direnv on nixos which pretty much sets up an isolated dev environment for my projects
Skylark
Skylark12mo ago
https://hub.docker.com/ here you can search for php and the databases you want, simply add them and run
Skylark
Skylark12mo ago
For instance https://hub.docker.com/_/php and https://hub.docker.com/_/redis they have readmes on what to do. I would recommend using Docker Desktop https://www.docker.com/products/docker-desktop/ as its much easier being able to point and click and visually see that things are working
php - Official Image | Docker Hub
While designed for web development, the PHP scripting language also provides general-purpose use.
redis - Official Image | Docker Hub
Redis is an open source key-value store that functions as a data structure server.
Moby Dock
Docker
Docker Desktop: The #1 Containerization Tool for Developers | Docker
Docker Desktop is collaborative containerization software for developers. Get started and download Docker Desktop today on Mac, Windows, or Linux.
From Moby Dock
From An unknown user
MD
MDOP12mo ago
I do have a docker account. any examples of dockerfile's or compose files that encompass an entire project? Also is there a way to still use my dev tools on vscode with them instead of vscode not knowing where anything is? goal is to run a database, php with composer and laravel, and nodejs with a FE framework
Skylark
Skylark12mo ago
Stackify
Docker for PHP: A Start-to-Finish Guide
This start-to-finish guide explains the basics so you can get up and running with Docker for PHP in your local development environment.
Skylark
Skylark12mo ago
You will probably want to run each of the parts in different containers anyway So your PHP container doesn’t have to worry about the databases and the node.js
MD
MDOP12mo ago
interesting is this difficult to do? running in different containers?
Skylark
Skylark12mo ago
Not at all, Docker handles it for you Or k8s/k3s I would really recommend using Docker Desktop just so it’s visual and it’s easier to see everything going on. Containerisation becomes a lot easier to understand when you can see all of your containers (I use k3s for development, I make a lot of microservices (I love microservice architecture and I would never tell anyone hiring me for the work that you almost never need microservices [containerisation is different and necessary]) and I can host all of my microservices on my Raspberry Pi cluster and I could absolutely just use it through command line but may as well use a GUI for it. You almost never need to use solely command line, GUIs make the whole process easier. Also as a Docker vs Kubernetes thing, use Docker, it's easier)
MD
MDOP12mo ago
Unfortunately nixos doesn't have a docker desktop package
Want results from more Discord servers?
Add your server