Setting up a development enviroment in Docker

Hi Everyone,

I am slowly switching from Xampp (on my Windows machine, home projects) to Docker, at least I want to.

Now I have to admit that I don’t use my Windows laptop much for writing code, as I have a MacBook Pro where I develop within Vagrant for a really big project.

In addition to this large project, I also want to pick up smaller projects that need their environment. Now it is a bit overkill to throw a whole vagrant box at this if we do set up a new environment for these kinds of projects.

On the website http://geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/, I came across a tutorial about docker and its use as development.

On the website, they have this docker-compose.yml file:

web:
    image: nginx:latest
    ports:
        - "8080:80"
    volumes:
        - ./code:/code
        - ./site.conf:/etc/nginx/conf.d/site.conf
    links:
        - php
php:
    image: php:7-fpm
    volumes:
        - ./code:/code

Which mount the code folder in your current directory (besides the site.conf file, that is also in nginx).

What’s the best way to run composer here. Nginx mounts the code directory and passes it back to PHPfpm?

In addition, what is the best approach to run different applications (different docker containers?)