如果没有错误消息输出,那么docker-compose.yml文件的语法应该是正确的。 接下来,可以尝试使用docker-compose up命令来启动服务,以确认修改是否解决了问题。 通过遵循上述步骤,你应该能够解决“volumes must be a mapping”的错误,并确保你的docker-compose.yml文件正确配置了卷。
当我运行 docker-compose up 时,出现以下错误。 错误:在文件 ‘./docker-compose.yml’ 中,服务 ‘volumes’ 必须是映射而不是数组。 registry: restart: always image: sudarshan/registry ports: - 5000:5000 environment: REGISTRY_HTTP_TLS_CERTIFICATE: /certs/domain.crt REGISTRY_HTTP_TLS_KEY: /certs/...
又觉得每次重创建docker后手动去修改很麻烦,所以想到在docker-compose.yml中定义该操作。
(已解决)ERROR: In file './docker-compose.yml', service 'networks' must be a mapping not an array 如题错误一般是docker-compose.yml的空格缩进问题导致,例如: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 version:"3.0" services: web: build: . ports: -"5000:5000" networks:# 缩进...
docker-compose自定义容器名称报错:ERROR: In file './docker-compose.yml', services 'container_name' must be a mapping not a string. 接上一个笔记。 继续自定义容器名称: 发现因为格式没有对齐原因导致该报错。 1 services-nginx-web:2image: nginx3expose:4 - 80...
模板文件是使用 Compose 的核心,默认的模板文件名称为docker-compose.yml,格式为 YAML 格式。 在旧版本(版本 1)中,其中每个顶级元素为服务名称,次级元素为服务容器的配置信息,例如 1 webapp: 2 image: examples/web 3 ports: 4 - "80:80" 5 volumes: ...
Hello , can anyone help me correct this yaml file please ( error : services must be a mapping) Docker Engine Compose yelmaadi (Yelmaadi) October 17, 2021, 11:00am 1 version: '3.0' services: db: image: mysql:5.7 container_name: mysql_database volumes: -db_data: /var...
在使用docker swarm时会用到了docker-compose.yml的挂载选项,所以研究了一下。官网中提到了四种(volume、bind、tmpfs、npipe),我这里只对其中volume和bind类型做了测试,总结如下。bind(挂载文件/目录)bind类型的两种书写格式 version: "3.9"services: web:image: nginx:alpine volumes:-type: bind so...
Type of issue [ x] Bug New feature Enhancement Description Following the documentation, went to fresh clone, scripts, build directory and ran docker-compose up Get the error: ERROR: In file '.\docker-compose.yml', service must be a mappi...
您可以在主机上挂载一个相对路径,该路径相对于正在使用的 Compose 配置文件的目录展开。相对路径应始终以.或开头..。 volumes: # Just specify a path and let the Engine create a volume - /var/lib/mysql # Specify an absolute path mapping - /opt/data:/var/lib/mysql # Path on the host, relative...