Trying to bind volume to a docker container

I’m trying to mount a volume to a docker container, but I have some problems with it. I have a simple python script in a docker container that creates file “links.json” and I would like to access this file from the filesystem.

This is my Dockerfile:

FROM python:3.6-slim

COPY . /srv/app
WORKDIR /srv/app

RUN pip install -r requirements.txt --src /usr/local/src

CMD [ "python", "" ]

I have created volume with:

docker volume create my-data

And I’m running this container with command:

docker run --mount source=my-data,target=/srv/app 3743b8d3b043

I’ve tried it on MacOS.

When I wrote: docker volume inspect my-data, I got this result:

        "CreatedAt": "2019-08-15T08:30:48Z",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/my-data/_data",
        "Name": "my-data",
        "Options": {},
        "Scope": "local"

But all directories like /var/lib/docker/volumes, and directories of this code are empty.. Do you have any ideas where’s the problem?

Thanks a lot!

Source: StackOverflow