The below file is a docker-compose file, like all docker-compose files it is saved as docker-compose.yml
The purpose of it is to serve as a baseline for hosting a variety of different services for testing.
In this example I will be going into getting a nginx container running with php ready.
Much of the above file we will not be using and is not completed in the example. What we are concerned with
is the container web1. The image used can be found on the docker hub under 'richarvey/nginx-php-fpm'.
You can see the image used by checking the 'image:' field under 'webserver1'. These fields define the
parameters we want our container to run on.
depends_on: States that another container is needed for this container, in this case 'db'
volumes: Attaches a directory from our filesystem to the containers file system. Any changes made on
the files will be made on the containers files as well. Useful for testing.
links: This is a legacy command and not needed in this case. All it does is explicitly state a connection
between our 'web1' and 'db', though by default they will be able to communicate anyway.
ports: This maps a port on our container to a port on our host. The format is 'host_port:container_port'.
It is recommended to always have this in a string since yaml parses integers in base-60.
In this example we use '80:80' since we want to reach our web1 webpage through HTTP on port 80.
Now that we have set up the container in compose we need to put useful config files in /builds/webserver/.
This is because we use our 'volumes' field to attach our web1.html homepage to /var/www/html/ as
explained earlier.
With that, our web1 container is done and can run PHP using docker-compose. You can edit index.html to
get the php setting screen. An example page would include: