I've been developing WordPress websites for a long time and I have to admit that I've tried a bunch of solutions to work locally and push my changes online as simple as possible.
At the beginning I was usign MAMP and a nice PHP script to do the search/replace once the database was uploaded into the online server.
Then I started to use Vagrant and Git, but the database part was always left apart with the script I linked before.
Later on I found WordMove, a great ruby gem that will let me pull/push all my changes (files and database) via an SSH connection. This was like the holy grail of WordPress development since I can download the online database into my local environment with a simple shell command: wordmove pull -d.
wordmove pull -d
Nowadays I am usign a bash script create from a collague of mine that will create a Docker container with WordMove installed on it.
This scripts helps me a lot because I can create a separate container where I can also experiment with the server configuration and be safe because, instead of a Vagrant solution, if I compromise the web server I am working on all the others will simply run.
The only downside I see in usign this solution with Docker instead of a Vagrant machine is that I can only run a WordPress installation at time because all of them are pointing to 0.0.0.0:8080, but if you edit the docker-compose.yml and configure the Apache Virtual Hosts I think you can solve this little problem.
At the end of the day this is a no brainer for me because shut down a container is simple as:
docker-compose up -d
(I use the -d option because it gives me back the terminal instead to show all the operations in a verbose manner)
Hope this can help, I'll link below a coupple of article we've written on WordMove and Docker. They are in italian but I hope Google Translate can help you out ;)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.