Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Rails in docker

185 vues

Publié le

Dockerizing a rails app and developing in it.

Start with an existing rails app (or rails new), build an image, start it, make and see changes to your running app

Publié dans : Technologie
  • Soyez le premier à commenter

Rails in docker

  1. 1. Rails in Docker Dockerizing and developing Andrew Klotz @klotzandrew
  2. 2. What is docker? - Package code, with environment, and dependencies - Docker images - Containers run images
  3. 3. What you need to install ● docker ● docker-compose ● docker-machine ● https://docs.docker.com/docker-for-mac
  4. 4. docker-machine ● eval $(docker-machine env default) ● docker-machine ls
  5. 5. Dockerized rails Ruby container ● Ruby ● Build ourselves Database container ● PostgreSQL ● Use official image
  6. 6. Docker image for rails ● Rails new or existing app ● Add a Dockerfile (touch Dockerfile)
  7. 7. ● Connect to containerized db in config/database.yml
  8. 8. Database ● official postgres image ● docker run --name db postgres ● docker ps
  9. 9. Docker orchestration - vim docker-compose.yml - docker-compose up
  10. 10. Check it out! ● visit (docker-machine ip):3000 ● docker ps ● see live code changes in the container ● run commands with a container ○ docker exec -it dockerrails_web_1 rails test ○ docker exec -it dockerrails_web_1 bash
  11. 11. Recap ● vim Dockerfile ● vim database.yml ● vim docker-compose.yml ● docker-compose up

×