Running and Deploying Rails to Docker Container

Jahkobi Digital picture Jahkobi Digital · Aug 7, 2013 · Viewed 7.4k times · Source

I am a total noob to linux containers and been spending some time learning about Docker, and forgive my confusion thought this question. Currently, I have a Rails app in production deployed via capistrano. My cloud servers are maintained with Opscode Chef on the Debian Wheezy distribution. For development, I have a Vagrant VM preinstalled with the app and services.

If I were to employ Docker, where would my app sit? The container or the host? How would I deploy (production) and share directories (development)? Can I run all my additional services ie memcache, redis, postgresql, etc on the same server using docker? I can maybe envision the potential of Docker but having trouble seeing its practical use.

Seems like containers are part of the future. Any guidance for someone making the switch from virtualization?

Answer

Emil picture Emil · Aug 22, 2013

If I were to employ Docker, where would my app sit?

It could sit inside the container or it could sit on the host(you can use docker build to copy the app into the container)

How would I deploy (production) and share directories (development)?

Deploying your app would mean committing your local container into an image, publishing it and running a container out of the published images on your servers. I have not tried sharing directories between host and container, but you can try this : https://gist.github.com/jpetazzo/5668338 . You can also write a Dockerfile which can copy a directory to a target in the container. Docker's docs on building images will help you there.

Can I run all my additional services ie memcache, redis, postgresql, etc on the same server using docker?

Yes. You will be running multiple containers on the same server.