Reputation: 31
when running docker-compose up -d I received one of many YAML: line 21: did not find expected key- below is the code:
services:
flask-app:
build: ./flask-app
ports:
- target: 5000
published: 5000
protocol: tcp
database:
image: mysql:5.7
container_name: mysql
ports:
- target: 3306
published: 3306
enviroment:
MYSQL_ROOT_PASSWORD: password123
MYSQL_DATABSE: flask-db
volumes:
- type: volumne
source: mysql
target: /var/lib/mysql
nginx:
image: nginx:latest
ports:
- target: 80
published: 80
protocol: tcp
volumes:
- type: bind
source: ./nginx/nginx.conf
target: /etc/nginx/nginx.conf
volumes:
MySQL:
I have been playing around with this for ages and it's just driving me mad- so would appreciate a different set of eyes on this in case I have missed anything.
Upvotes: 0
Views: 2161
Reputation: 39708
The line nginx:
is indented two spaces. It occurs after an outer mapping has been started with services:
at zero spaces, and an inner mapping has been started with flask-app:
which is indented four spaces. nginx:
has the wrong indentation for each of those mappings, this is why you get an error.
Your other indentations are very weird too. Does ports:
not belong inside database:
? Does source: mysql
not belong inside volumes:
? Does published: 80
not belong inside ports:
?
I suggest reviewing the indentations in the whole file and ensuring that each line is at the correct level and has the correct parent.
Upvotes: 1