简体   繁体   中英

Running and Deploying Rails to Docker Container

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM