How to fix docker-compose: services.my-service Additional property volume is not allowed
Deutsch
English
Problem:
When you try to start your docker-compose based service using
docker_compose_up.sh
docker-compose upyou see the following error message
docker_compose_volume_error.txt
services.my-service Additional property volume is not allowedwith a config such as
docker-compose-volume-typo.yml
services:
mariadb:
image: 'mariadb:latest'
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_DATABASE=redmine
volume:
- './mariadb_data:/var/lib/mysql'Solution
You’ve mis-spelled volume: - it always needs to be called volumes: even if there is only a single volume:
docker-compose-volume-fixed.yml
services:
mariadb:
image: 'mariadb:latest'
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_DATABASE=redmine
volumes:
- './mariadb_data:/var/lib/mysql'Check out similar posts by category:
Docker
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow