Building a Docker Image
Before proceeding, let’s take one last look at the web service defined in the docker-compose.yml:
| web: |
| build: . |
| volumes: |
| - ./log:/home/app/depot/log |
| secrets: |
| - source: master_key |
| target: /home/app/depot/config/master.key |
| ports: |
| - "8001:80" |
| depends_on: |
| - db |
We’ve seen the volumes definition before; in this case it maps the log directory in the container to our local log directory. We previously covered how secrets are managed.
ports is new. This maps port 8001 on our development machine to port 80 in the container. This means that we’ll be able to access our application as http://localhost:8001 once it’s up and running.
depends_on controls the startup ...
Get Agile Web Development with Rails 7 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.