24

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?

2 Answers 2

12

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.

Sign up to request clarification or add additional context in comments.

5 Comments

Cheer, @Emil. Great response.
Can those additional services be inside their own docker container, or can they all be inside one docker container?
@CMCDragonkai Suggested practice would be to run every service in its own container, so they're modular: use your memcached image to run containers for multiple apps, run 3 instances of your web app container to load-balance between them (with an haproxy container!). See the Link docs for helping containers find one another. You might also like Fig for running them. Note the fig scale command for multiple instances.
@ches Are you saying by using a container for each service, such as a container for my app, a container for mysql, a container for redis.. etc. This allows each to be swappable, scalable and load balanced?
@CMCDragonkai Yes, that should be a goal for your Docker deployments -- though you have to do some of the work to make things horizontally-scalable yourself: Docker doesn't provide load balancing, etc. automatically (and scaling MySQL or Redis horizontally is not a matter of ordinary load balancing!). Mainly, don't hardcode configuration, ports and storage volumes in your container images, Docker helps make them discoverable, like with environment variables (see earlier Link doc). Shared storage is tricky -- here's a great example.
2

I'm no expert and I haven't even used docker myself, but as I understand it, your app sits inside a docker container. You would deploy ideally a whole container with your own ruby version installed and so on.

The big benefit is, that you can test exactly the same container in your staging system that you're going to ship to production then. So you're able to test the complete system with all installed C extensions, the exact same ls command and so on.

3 Comments

Does this mean it replaces Capistrano?
not necessarily. you could use capistrano to deploy to a docker container. capistrano puts your code somewhere. docker puts your machine somewhere.
Thanks for your answer. I did some more reading, and Docker actually looks excellent. It is not quite ready though... so I will keep an eye on it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.