标签: yaml

运行 docker-compose 时,“volumes 'type' 是必需的属性”

我正在了解 docker-compose.yaml 的工作原理。我正在尝试在撰写文件中定义一个卷并将其挂载在本地的挂载点。我尝试运行一个基本的 .yaml 来挂载我的卷:

version: '3.2'
services:
      mydb:
        image: postgres
        volumes:
          - db-data:var/lib/postgres/data
        ports:
          - "5432:5432"
        volumes:
          - db-data:
          - driver: local
Run Code Online (Sandbox Code Playgroud)

但是当我运行时docker-compose down,我收到一个错误:

$ docker-compose down
The Compose file '.\docker-compose.yml' is invalid because:
services.mydb.volumes 'type' is a required property
services.mydb.volumes 'type' is a required property
Run Code Online (Sandbox Code Playgroud)

我对此很陌生,并且仍然了解使用 Docker 的所有细微差别。我认为我的问题是缩进错误或我如何使用扩展名调用版本号,但我似乎无法理解错误。

bash container docker yaml

8
推荐指数
1
解决办法
2万
查看次数

docker-compose 出现“卷‘类型’是必需属性”错误

我刚刚开始学习 docker 的工作原理,在使用 docker-compose 时遇到 yaml 文件的问题。

version: '3.7'
services:
  portainer:
    container_name: portainer
    image: portainer/portainer
    volumes:
      - portainer_data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    restart: always
    ports:
      - "9000:9000"

  hass:
    container_name: hass
    image: homeassistant/home-assistant
    volumes:
      - /home/flory/home_assistant:/config
      - /etc/letsencrypt:/certs
    restart: always
    network_mode: host

  mqtt:
    container_name: mqtt
        container_name: mqtt
    image: eclipse-mosquitto
    restart: always
    volumes:
      - /home/flory/mosquitto/config: /mosquitto/config
      - /home/flory/mosquitto/data: /mosquitto/data
      - /home/flory/mosquitto/log: /mosquitto/log
    ports:
      - 1883:1883
      - 9000:9000

volumes:
   portainer_data:
Run Code Online (Sandbox Code Playgroud)

我收到如下错误:

services.mqtt.volumes 'type' 是必需的属性。

有人可以帮我纠正这个问题吗?

docker yaml mqtt docker-compose

4
推荐指数
1
解决办法
4792
查看次数

无法使用ansible形成站点中文件的链接 - 可用于远程服务器中启用的目录站点?

无法使用ansible形成站点中文件的链接 - 可用于远程服务器中启用的目录站点?

这是我想使用 ansible 的文件模块执行的命令: ln -s /etc/apache2/sites-available/wsgi-keystone.conf /etc/apache2/sites-enabled

这是我正在使用的任务的代码:

- name: Enable the Identity service virtual hosts
  file: src=/etc/apache2/sites-available/wsgi-keystone.conf dest=/etc/apache2/sites-enabled state=link owner=root group=root mode=0644
Run Code Online (Sandbox Code Playgroud)

顺便说一下,我以 root 用户身份运行剧本:

得到以下错误:

fatal: [10.0.1.32]: FAILED! => {"changed": false, "failed": true, "gid": 0, "group": "root", "mode": "0755", "msg": "refusing to convert between directory and link for /etc/apache2/sites-enabled", "owner": "root", "path": "/etc/apache2/sites-enabled", "size": 4096, "state": "directory", "uid": 0}
Run Code Online (Sandbox Code Playgroud)

linux automation ubuntu-14.04 yaml ansible

3
推荐指数
1
解决办法
8720
查看次数