This is a simple guide to use docker.
Δ Important
•This tutorial asumes that you have the dockerfile and docker-compose.yml inside the project folder
Δ Important
•It is necessary to start the docker daemon to use docker.
•You should add your user to the docker group in order to use it as a normal user (not sudo).
$ docker build . #Dont forget the dot! ;)
This will download all the requeriments for corottos web app . It might take a while
Δ Important
•It is necessary to run this inside the project folder with the **dockerfile** inside
After the image is downloaded you will see it within all the docker images you've download:
Docker compose is a tool to run multi-container Docker applications.
Δ Important
•It is necessary to change the docker-compose.yml file. Change the working directory to yours
$ docker-compose up
After the postgres image is downloaded you will be able to run the app!
To run any rails command you just need to use docker-compose:
$ docker-compose run corottos rake db:create db:migrate
•When adding a new gem to the gemfile just use docker-compose build to run bundle install
•There are some simple but necessary changes to make to the database.yml file (attached in the folder)
•Using prax is exactly the same thing as usual
To run the app:
$ docker-compose up
It is really easy to connect! Just forward the ports in the docker-compose file: (already on example files)
db:
image: postgres
ports:
- '0.0.0.0:5432:5432'
...
And connect to localhost/your_ip:5432 through pgadmin!