Docker: Ubuntu Nginx + PHP Stack
This is the basis for a LEMP stack (minus MySQL). This is based on phusion/baseimage-docker base Ubuntu image, which takes care of system issues which Docker's base ubuntu image does not take care of, such as watching processes, logrotate, ssh server, cron and syslog-ng.
# Run the docker container docker run -v /path/to/local/web/files:/var/www:rw -p 80:80 -d webserver /sbin/my_init --enable-insecure-key
This will bind on local port 80 to the containers port 80. This means you should be able to go to "localhost" in your browser ( or the IP address of your virtual machine oh which Docker is running) and see your web application files.
docker run- starts a new container
-v /path/to/local/web/files:/var/www:rw- bind to the local directory to a directory in the container for file sharing.
rwmakes it "read-write", so the container can write to the directory
-p 80:80- Binds the local port 80 to the contianer's port 80, so local web requests are handled by the docker.
-d webserver- User the image tagged webserver
/sbin/my_init- Run the init scripts used to kick off long-running processes and other bootstrapping, as per phusion/baseimage-docker
--enable-insecure-key- Enable a generated SSL key so you can SSH into the container, again as per phusion/baseimage-docker. Generate your own ssh key for production use.
- If you use this with fideloper/docker-mysql, then link this container with MySQL's (after running the MySQL container first) via