Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Docker volume mount includes invalid characters: If you intended to pass a host directory, use absolute path

I am having trouble with two-way folders with Docker.

    defaultCfg.Mounts = append(ContainerHostConfig.Mounts, mount.Mount{
        Type:   mount.TypeVolume,
        Source: fmt.Sprintf("/root%s", tmp),
        Target: fmt.Sprintf("%s", tmp),
    })

Source and target works when using bind (with CreateMountpoint being true on bind config), but on volume i have this error:

"failed to create container: Error response from daemon: create /root/tmp/metrics-60-1990068486: "/root/tmp/metrics-60-1990068486" 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"

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

"error is as descriptive as it can get"

"read the error"

"are you capable of reading"

If you intended to pass a host directory, use absolute path

isnt this absolute?

/root/tmp/metrics-60-1990068486

what is wrong?

>Solution :

Mounting a directory is called a bind mount, so you need to use mount.TypeBind instead of mount.TypeVolume.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading