Web development transition from MAMP to Docker
You can now use docker-compose
and a docker-compose.yml file to accomplish the same thing as fig.
Finding containers for each service and linking them together isn't the easiest thing. The docker-compose file from The damp github project (pasted below for posterity) is a good start for how to get the apache, php, and mysql services all running with a docker-compose -f docker-compose.yml up
command.
proxy:
image: jwilder/nginx-proxy
ports: ['80:80']
volumes: ['/var/run/docker.sock:/tmp/docker.sock:ro']
environment: [DEFAULT_HOST=damp.dev]
database:
image: 'mysql:5.7'
ports: ['3306:3306']
environment: [MYSQL_ROOT_PASSWORD=password]
phpmyadmin:
image: corbinu/docker-phpmyadmin
links: ['database:mysql']
environment: [MYSQL_USERNAME=root, MYSQL_ROOT_PASSWORD=password, VIRTUAL_HOST=phpmyadmin.damp.dev]
damp:
image: httpd
volumes: ['~/damp/damp:/usr/local/apache2/htdocs']
environment: [VIRTUAL_HOST=damp.dev]
Once you do that _and put an entry for damp.dev 127.0.0.1
in your hosts file, anything you mount in ~/damp/damp (per that second to last line) will be put in the htdocs of the docker container and served up on damp.dev/[whatever].
damp is just the first example I found poking around on how to replicate MAMP with docker. The most important thing to note is that you can use docker-compose
instead of fig
. Compose is based directly on the Fig codebase and is backwards-compatible with Fig applications.