I\'m using boot2docker on OS X and cloned the following repo:
https://github.com/enokd/docker-node-hello
It basically has a Dockerfile and a very simple express
There's several scenarios that docker can help on web development:
lighting fast provision all different kinds of services locally. you want a clean couchdb, run docker run -d -p 5984:5984 tutum/couchdb
; mysql, no problem: docker run -d -p 3306:3306 tutum/mysql
, a selenium server with firefox? easy: sudo docker run -p 4444:4444 -d lzhang/selenium
, you will get them immediately, and they can be destroyed by docker kill
the next seconds you don't want them. fit the local testing scenario very well, no need to worry how to configure them.
manage software dependencies. for example, you want to run your node app under different node versions (0.8, 0.10, 0.10.25, etc), just find the nodejs docker images by docker search nodejs
, and create containers by mounting your application directory as volume, you can run multiple containers which is isolated to each other. Take a look at my keystonejs-example project on how to run a complicated node app with mongodb in seconds with 0 configuration. thinking a more complicated model: load balancer + app + database + cache, in old school way, there're tons of configuration options to fit the setup procedure, but, if you provision them as separate containers and link them by names, every components can discover each other by local environment variables, just like a local PaaS.
an easy way to use application by searching docker index. for example, there is a neat tool called Heartbleed checker, you can quickly download/use it in a container with ready configuration by a single command, even don't need to think about config, download language runtime, configure, uninstall, etc.
Per boot2docker, I assume you're on OSX, so you'd better pickup version v0.9.2+ which supports hostonly network configuration, then you can access the containers run inside the VM over the hostonly network.