docker编写卷绑定不一致

docker编写卷绑定不一致,docker,docker-compose,docker-volume,Docker,Docker Compose,Docker Volume,我在docker compose中看到了不一致的行为,我想问一下这背后是否有原因 这是我的docker-compose.yml文件 version: '3.7' services: test: image: "testImage" volumes: - ./:/app - ./file_with_content.yml:/app/final.yml 包含内容的文件。yml=>包含一些内容 没有内容的文件。yml=>一个空文件 现

我在docker compose中看到了不一致的行为,我想问一下这背后是否有原因

这是我的docker-compose.yml文件

version: '3.7'

services:
  test:
    image: "testImage"
    volumes:
      - ./:/app
      - ./file_with_content.yml:/app/final.yml
包含内容的文件。yml
=>包含一些内容
没有内容的文件。yml
=>一个空文件

现在,当我尝试运行命令时

docker compose-f docker-compose.yml run-v/Users/file_without_content.yml:/app/final.yml--entrypoint/bin/bash test

然后执行
cat final.yml
;我看到了不同的结果

有时我会看到空内容,有时我会看到没有内容的
文件.yml
内容

背后的逻辑是什么?谢谢你的帮助