gpt4 book ai didi

Docker 卷必须是映射,而不是字符串

转载 作者:行者123 更新时间:2023-12-01 12:22:10 25 4
gpt4 key购买 nike

我在 ./wordpress/docker-compose.yaml 有以下文件:

version: '3.3'

serivces:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
evironment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress

wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
volumes:
- ./:/var/www/html
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress

volumes:
db_data

当我跑 cd ./wordpress && docker-compose up -d我收到以下错误:
ERROR: In file './docker-compose.yaml', volume must be a mapping, not a string.

谁能告诉我我做错了什么?

最佳答案

首先有一些拼写错误,比如 serivces , evironment .他们应该拼写 servicesenvironment .同样对于“...不是字符串”错误,只需在卷名后附加“:”,如下所示
volumes:
db_data:

关于Docker 卷必须是映射,而不是字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49937772/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com