About volume, I have a strange situation

docker run -d   --name=apmserver   --mount source=apm.yml,destination=/usr/share/apm-server/apm-server.yml,readonly   ccr.ccs.tencentyun.com/open-containers/apm-server:7.6.1
docker: Error response from daemon: source is not directory.
See 'docker run --help'.


docker run -d   --name=apmserver   --mount source=./apm.yml,destination=/usr/share/apm-server/apm-server.yml,readonly   ccr.ccs.tencentyun.com/open-containers/apm-server:7.6.1
docker: Error response from daemon: create ./apm.yml: "./apm.yml" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'.

docker run -d   --name=apmserver   --mount source="/tmp/apm-server.yml",destination="/usr/share/apm-server/apm-server.yml",readonly   ccr.ccs.tencentyun.com/open-containers/apm-server:7.6.1
docker: Error response from daemon: create /tmp/apm-server.yml: "/tmp/apm-server.yml" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'.

Why is the volume name error always displayed?

I still get an error if I change the file name

docker run -d --name=apmserver -v ./apm.yml:/usr/share/apm-server/apm-server.yml:ro ccr.ccs.tencentyun.com/open-containers/apm-server:7.6.1
docker: Error response from daemon: create ./apm.yml: “./apm.yml” includes invalid characters for a local volume name, only “[a-zA-Z0-9][a-zA-Z0-9_.-]” are allowed. If you intended to pass a host directory, use absolute path.

docker run -d \

–name=apmserver
-v apm.yml:/usr/share/apm-server/apm-server.yml:ro
ccr.ccs.tencentyun.com/open-containers/apm-server:7.6.1
docker: Error response from daemon: source is not directory.
See ‘docker run --help’.

docker version:19.03.8

Try

-v "$(pwd)/apm.yml:/usr/share/apm-server/apm-server.yml:ro"

@tekki Thank you for your reply.

I solved the problem.

Why is the above error?

I have tested the absolute path (like -v /xxxx/apm.yml) and it will also report an error