Docker is an open platform for distributed applications for developers and sysadmins. It can be used to quickly develop and deploy web applications.
You will need to first install Docker. Instructions can be found here:
Build and Run a Container
By default you can connect to the site at http://localhost:9292
Opening an additional terminal
You can open a second terminal and run:
docker-compose app /bin/bash -l
This will allow you to run other commands like
Using a docker proxy
With a docker proxy you can avoid port conflicts with 9292, and the domain name of the site is friendlier. Once setup, you can access the site at: http://labinteractives.docker
To use this approach you need to:
- install and setup the proxy
- configure docker-compose to use a random port instead of 9292
The proxy we use is https://github.com/codekitchen/dinghy-http-proxy it has support for OS X, Linux, and Windows. At the link above you need to look at the section: Using Outside of Dinghy
docker-compose can be configured by adding a
.env file at the top of the repository with the contents
Notes for running without docker-compose
To build and run a container:
docker build -t lab-interactives-site .
docker run --name interactives -p 9292:9292 -p 35729:35729 lab-interactives-site
Now you can connect to the server with http://localhost:9292
To connect to the LiveReload server, you’ll have to create an SSH tunnel after the container has started.
docker-machine env defaultto get the machine’s IP address
ssh -N -L 35729:localhost:35729 docker@<ip_addr_for_docker_machine>to start the ssh tunnel
If you don’t want to bother with SSH tunnels, you can use RemoteLiveReload instead. However, you’ll have to run the following command before building and starting the container.
sed -i "s/guard 'livereload'/guard 'livereload', host: '0.0.0.0', port: '35729'/" Guardfile