Docker run command gives source path doesn't exist error although path exists

Hi,

I’m trying to run the docker command:

docker run $DOCKERINTERACTIVE -t --mount type=bind,source=$SCRIPTPATH,target=/s -w=/s $RUNUSERID

but it gives me the below error:

docker: Error response from daemon: invalid mount config for type “bind”: bind source path does not exist: /mnt1/vendor_build/06_11

I’m trying to run this command from mounted disk on Ubuntu. This command works fine on $HOME path, can someone help me if I’m missing something.

Thanks!

How was it mounted? I know there were multiple similar issues with mounted NFS, but I haven’t tried it yet.

Can you try to bind mount the mounted folder to an other location without Docker to see if it is empty or not? I think the command should be:

mount --bind /mnt1/vendor_build/06_11 /new/test/location

Thanks for your reply.

Mounting has been done using these steps:

I tried the command you mentioned, it seems like working fine, I don’t get error.

I see. So it is not even a remote network filesystem, but a local disk, right? It should definitely work then.

You also mentioned it in your original post, but I missed that:

How did you installed Docker? Did you follow the official documentation?

Make sure you don’t install Docker from the Snap repository.

Please, share the output of

docker version

Output of docker version command is :

Client:
Version: 20.10.7
API version: 1.41
Go version: go1.13.8
Git commit: 20.10.7-0ubuntu5~18.04.3
Built: Mon Nov 1 01:04:14 2021
OS/Arch: linux/amd64
Context: default
Experimental: true

Server:
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.16.15
Git commit: a89b842
Built: Thu Sep 22 06:22:13 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit:
docker-init:
Version: 0.19.0
GitCommit: de40ad0

I installed docker using the command:

sudo apt-get -y install docker.io

So it is not snap at least, but it is not the latest Docker Engine from the official APT repository of Docker.
It should be able to bind mount from a mounted disk, but I still recommend to remove that version and install Docker from the official documentation I linked above. Since you are using Ubuntu, this is a more direct link:

As you can see it starts with the instruction to remove docker.io

sure, will try and update!

Hi @rimelek, I uninstalled and installed the latest version using the steps mentioned in the link you shared, I still get the same error. :frowning:
Can you suggest any other pointers

I have one question, might be a noob one. As I said, error happens in the newly mounted disk. Is it possible that docker is trying to bind the path of newly mounted disk from ~ , that is the reason it says source path doesn’t exist?

Do you mean from the user’s home? The Docker daemon is running as root and Docker would not use a reference like “~”. Maybe only to access the user’s docker client config. How would that work? I can’t even imagine.

On the other hand, you gave me an idea. Is this the correct path?

 /mnt1/vendor_build/06_11

I mean /mnt1 seems strange. Isn’t that just /mnt ?

Yes, that is the correct path.

stat /mnt1

gives below output:

File: /mnt1
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 10301h/66305d Inode: 2 Links: 6
Access: (0755/drwxr-xr-x) Uid: ( 1002/sduddell) Gid: ( 0/ root)
Access: 2022-11-15 11:35:54.754002975 +0000
Modify: 2022-11-15 11:35:53.393976551 +0000
Change: 2022-11-15 11:35:53.393976551 +0000
Birth: -

Then it’s time to debug step by step. Try to mount the root of the host like:

docker run -v /:/host ...

Then list the fles in /host/mnt1.

If that works, then you can try to mount /mnt1/vendor_build and list the files in the mounted path in the container again. If you get invalid source path again in any step, you will know which folder contains an invalid character even if that is a non-printable character.

Can I run the command you shared as it is?

docker run -v /:/host …

If yes, it is giving me below error:

docker: invalid reference format.
See ‘docker run --help’.

No, you can’t. I only showed the syntax of the volume mouning. ... means “and so on”

I’m not sure if I ran the correct set of commands, but this is what I have done.

I tried to mount the /mnt1 using

docker run -v /:/mnt1 -w /mnt1 -i -t ubuntu pwd

It seemed like worked, on listing the docker files in /mnt1 , I got below output:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

I went ahead and tried to mount /mnt1/vendor_build using the command:

docker run -v /:/mnt1/vendor_build -w /mnt1/vendor_build -i -t ubuntu pwd

it did not give any error too.
Please correct if I’m doing anything wrong.

The source path has to be on the left side of the colon and the destination (path in the container) has to be on the right side. All your commands just mount the root of the host to different folders in the container. This could work:

docker run --rm -v /:/host ubuntu ls -l /host
docker run --rm -v /mnt1:/host ubuntu ls -l /host
docker run --rm -v /mnt1/vendor_build:/host ubuntu ls -l /host

Note that I used --rm which removes the container after running it. Without this you will have many stopped containers on your host. You can see that with docker ps -a

Thanks for correcting @rimelek .

First command ran fine. But second command gives the below error:

docker: Error response from daemon: error while creating mount source path ‘/mnt1’: mkdir /mnt1: read-only file system.

And what about the last command?

After that you can try these too:

docker run --rm -v /:/host ubuntu ls -l /host/mnt1
docker run --rm -v /:/host ubuntu ls -l /host/mnt1/vendor_build

Here are the commands and their outputs:

command 1:

docker run --rm -v /mnt1:/host ubuntu ls -l /host

output 1:

docker: Error response from daemon: error while creating mount source path ‘/mnt1’: mkdir /mnt1: read-only file system.

command 2:

docker run --rm -v /mnt1/vendor_build:/host ubuntu ls -l /host

output 2:

docker: Error response from daemon: error while creating mount source path ‘/mnt1/vendor_build’: mkdir /mnt1: read-only file system.

command 3:

docker run --rm -v /:/host ubuntu ls -l /host/mnt1

output 3:

ls: cannot access ‘/host/mnt1’: No such file or directory

command 4:

docker run --rm -v /:/host ubuntu ls -l /host/mnt1/vendor_build

output 4:

ls: cannot access ‘/host/mnt1/vendor_build’: No such file or directory

Now it’s clear that you don’t have /mnt1 on the host exacrly as I suspected. Then you wrote the following:

Where did you exactly run that stat command? Based on your previous docker commands before I corrected the source and destination, you used /mnt1 on the right side. Now I am starting to think that it is actually inside the container. What I don’t understand now, what you try to mount.