Note: install kitematic on mac to have docker running inside a VM.
- build the image within the image folder
docker build -t <tag-name> .
nginxexposed on the port80.- Run
/usr/sbin/nginx -c /etc/nginx/nginx.confas the entrypoint. - Virtual host configuration can be mounted into
/etc/nginx/conf.d/
php-fpmexposed on the port9000.- Run
/usr/sbin/php5-fpm --nodaemonizeas the entrypoint.
- start a container:
docker run [-it] [-d] [--rm] [-p <host-port>:<container-port>] [-v <host-volume:container-volume>] [-l <container-name>:<var-name>] --name <container-name> <tag-name> [cmd] - run a command on a running container
docker exec <container-name> <cmd> - start nginx linked with php-fpm with
docker-compose(inappfolder):docker-compose up nginx-php - start nginx linked with php-fpm (in
appfolder):
docker run -d --name php-fpm -v $(pwd)/html:/var/www/html demo/php-fpm:latest
docker run -d --name nginx-php -v $(pwd)/config:/etc/nginx/conf.d -p 80:80 --link php-fpm:php demo/nginx:latest