Heroku documentation says that volumes are not supported by heroku:
What should I use instead of volume for heroku?
I have following docker-compose.yml file:
version: '3.9'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
networks:
- wpsite
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- '8000:80'
volumes: ['./:/var/www/html']
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
networks:
- wpsite
networks:
wpsite:
volumes:
db_data:
CodePudding user response:
I think there is a misunderstanding between dockerfile
and docker-compose
.
A dockerfile allows to build docker images
A compose file allows to define and run multi-container Docker applications
You can use
volumes
indocker-compose.yml
as shown in that documentation from Heroku : Heroku documentationYou can not use
VOLUME
instruction in adockerfile
which is described in the following documentation: Docker documentation