This sample project includes a basic node (express) app, spawned on 2 instances, load-balanced via nginx. Refresh the page to see round-robin in action with a custom message from each container.
- Install Docker
cp .env.sample .env
and modify if necessary (read on)
- Run
docker-machine create -d virtualbox my-project
to create a machine on virtualbox - View the machine docs for specific commands for other drivers
- Run
eval $(docker-machine env my-project)
to run commands against the new machine- If you created a machine on a remote host you'll need to copy files there
- Find pwd of ssh user:
docker-machine ssh my-project pwd
(for me,/root
) - Copy project files to remote host:
docker-machine scp -r ./ my-project:/root/
- Modify .env to specify the project root on host
ROOT=/root
- Find pwd of ssh user:
- If you created a machine on a remote host you'll need to copy files there
- Run
docker-compose -f docker-compose.yml up
to start the containers
- (optional) Run
docker-machine ip my-project
to find the machine ip - Point your browser to the ip (localhost:80) or use curl