Answer the question
In order to leave comments, you need to log in
What do volumes mean at the end of docker-compose.yml?
I'm trying to forward static from an application to nginx. There are 2 containers with an application and nginx in the article I found how to do it, but I can’t understand what the “static_volume” lines mean and where they are defined. If it were a folder, then the path would be - ./static_volume/:/home/app/web/staticfiles
. I didn't find anything specific in the documentation.
version: '3.7'
services:
web:
build:
context: ./app
dockerfile: Dockerfile.prod
command: gunicorn hello_django.wsgi:application --bind 0.0.0.0:8000
volumes:
- static_volume:/home/app/web/staticfiles
expose:
- 8000
env_file:
- ./.env.prod
nginx:
build: ./nginx
volumes:
- static_volume:/home/app/web/staticfiles
ports:
- 1337:80
depends_on:
- web
volumes:
static_volume:
volumes:
static_volume:./app/static/
Answer the question
In order to leave comments, you need to log in
The volumes block defined at the first level of the yaml file (before or after servies, it doesn't matter) is intended to specify storage mount areas common to all services.
You have specified:
volumes:
static_volume:
/var/lib/docker/volumes/static_volume/_data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question