So I dockerised my app - what now?

So after some trial and noob error, I managed to dockerise my ruby or rails app and postgres db using docker-compose.

I can run docker-compose up and it runs and it can access it via URL.

Being such a noob, and still struggling to see the point of me doing this, can someone point me to how I can use it?

Specifically

    • Source control so others can work on my app too. Do they just pull it from git and build and run it?
    • Do I need the Dockerfile as well as the docker-compose? If I need both, would anyone who pulls down my codebase need to run docker build and then docker-compose up? Or docker compose build?
    • Deployment. We use cloud foundry and bamboo, how should I deploy this using docker, what advantages will I see?

Apologies if these have been answered elsewhere.

Anyone care to give me some suggestions.

On top of the above, it seems the my database is temporary too (I guess I should have expected this?). So everytime I do a docker compose down, and then a docker compose up, I need to do a db:migrate and db:seed.

All previous data will be lost? How do folks get round this for local testing?

I have answered some of your questions below

Source control so others can work on my app too. Do they just pull it from git and build and run it?

Yes, you would host your project online somewhere like github, people can pull it work on it and then submit pull requests back to your repo.

Do I need the Dockerfile as well as the docker-compose? If I need both, would anyone who pulls down my codebase need to run docker build and then docker-compose up? Or docker compose build?

Yes, and No. The are different things, the Dockerfile is for building a image, setting up ruby in the image, exposing ports ect. The docker-compose creates a container from the image you made, it can also create other containers such as your databse. More info here

All previous data will be lost? How do folks get round this for local testing?

You need to look into persistence, docker containers by default do not store anything permanently, unless you tell it tooby mounting a folder or by mounting a volume. You say you are using postgres, here is a guide on how to make data persistant in the official image

1 Like