Docker inspect <volume> points to wrong mount point?

Search documentation, check.
Search github, check.
Search forum, check.

When i run a docker inspect on a volume the mount point is given as /var/lib/docker/volumes/<volume name>/_data. However, this path does not exist on Mac.
I know i can address a volume on Mac using <volume name>: so to copy data onto the volume, instead of copying from source to /var/lib/docker/volumes/<volume name>/_data i can copy from source to <volume name>:
I want to run three containers running apache with the same content.
I create the volume docker volume create website
I run the first container docker run -d --name web1 -p 80:80 -v website:/usr/local/apache2/htdocs:ro httpd:2.4
i exec into the container docker exec -ti web1 bash and find no website data in the container. In htdocs i only find the default apache index.html
When i look at the mounts, i do see the Source and destination, but again the source path is wrong.

        "Mounts": [
            {
                "Type": "volume",
                "Name": "website",
                "Source": "/var/lib/docker/volumes/website/_data",
                "Destination": "/usr/local/apache2/htdocs",
                "Driver": "local",
                "Mode": "ro",
                "RW": false,
                "Propagation": ""
            }
        ]

What am i missing here?

Hi toontje1,

On mac OS docker run inside a virtual machine.

you have to run the following command :
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

Just press Enter after you could find your volume in the right place.
Best regards,
Fouscou B.

Please, use the code block button (</>) to insert codes or almost anything that is not a plain text. Your XML-like placeholders completely disappeared thanks to the Markdown filter until I fixed your post.

That is not a copy, just a mounted folder from the host. It is important to understand the difference. By docker volume create website just creates a folder on the host. When you run your container wth that volume it also by default copies the content from the image to the volume if the target folder is not empty and the volume is empty.

What was expectation? I don’t see any command which would result any other content on the volume.

@fouscou is right again. You don’t see the path because it is inside the virtual machine, however, you don’t need to see it. You only need the content and you can indeed mount it into multiple containers.

Can you share the exact steps how you created the content that you expected to be on the volume and how you started each container?

It depends on the version of Mac and Docker. I think the following command should work on any Mac:

docker run --pid=host --privileged -it --rm justincormack/nsenter1

Ok, let me get this straight:
I have a directory on my local hard drive where the content for my website lives.
I create a volume using docker volume create website which i want to use as source for multiple containers using the same website content.
According to docker inspect volume website this content needs to go into /var/lib/docker/volumes/<volume name>/_data which is a path that doesn’t exist on a Mac. So docker inspect giving incorrect results on a Mac needs to be fixed, IMHO.
Then, when i run the container, i use -v website:/usr/local/apache2/htdocs:ro to map the volume i created (which still doesn’t have my website content in it) to the container. This makes that i only see the default index.html because, again, i missed the step that points the content of the volume volume to the content on my local drive. I was expecting that when i copy my website content to the volume website:, i should have been good to go.
I get the feeling i am missing something very, very obvious.

That result is correct. As we mentioned before, containers on Mac are running inside a virtual machine. You could have a docker client on your local machine and the docker engine on a remote server. It would give you the same result. The volume would not exist on your local machine. docker inspect will talk to the remote server (virtual machine in this case) and get the information about the environment on that remote machine, not on your local machine.

Yes, if you copy your files correctly, but you haven’t told us how you copied your files. You should use docker cp: docker cp | Docker Docs

On the other hand, if you have your files locally, you could also mount them instead of copying them to a volume: Bind mounts | Docker Docs

Got it. I was using the normal cp command. docker cp did it.

Thanks for the help,

Ton.