Invalid mount config for type "bind"


Been searching now for a couple of hours without solution.

Updated to latest docker-compose and still having same issue:

ash-4.4# docker-compose --version
Docker Compose version v2.23.3

Docker is provided by Synology, Intel x86-64

ash-4.4# docker --version
Docker version 20.10.23, build 876964a
ash-4.4# uname -a
Linux ULTRA-NAS-1 4.4.302+ #69057 SMP Mon Nov 13 14:21:00 CST 2023 x86_64 GNU/Linux synology_denverton_1819+

Issue is build fails with following error:

ash-4.4# docker-compose up
[+] Running 0/0
 ⠋ Container rhel-ubi-9  Creating                                                       0.0s 
Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /volume1/docker/archive/rh9/rhel


ash-4.4# pwd
ash-4.4# whoami


version: '3.7'

    image: 'redhat/ubi9:latest'
    container_name: 'rhel-ubi-9'
      context: './rh9/root'
      dockerfile: '../Dockerfile'
        - 'img=redhat/ubi9:latest'
      - .:/test
      - type: bind
        source: '/volume1/docker/archive/rh9/rhel '
        target: '/rhel'
        read_only: true
      - aux
      - 22



ARG img
FROM ${img}

RUN mkdir -p "/rhel"
VOLUME /rhel

ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

CMD ["/bin/bash"]

RUN rm -rf /var/log/*

RUN dnf -y install nginx; dnf clean all; systemctl enable nginx;

Docker is run as root, and has access to this valid directory…

Please correct this bug or enhance the error to correctly identify the issue.

Thank you.

Docker complains that the host path /volume1/docker/archive/rh9/rhel (including the trailing space character that you also use in your compose file). Either the path exists without the trailing space, then delete the trailing space, or if the path does not exist, then create it.

[quote=“mrdkvv, post:1, topic:138878”]

Very true,

Understood – Sadly, this error may have also been preventing

- .:/test

where the /test folder also was not created … ???

I’ve marked the response as solved as my testing for the mount during “dockerfile” would always fail and is by design, where the mounts run “AFTER” the docker file that really surprised me as i would have thought the mounts would be available during setup… I guess only at run time :frowning: And can’t find any documentation to set this expectation.

Everything underneath the build element is used during build, and of course image: as it will become the name of the created image. The VOLUME instruction in a Dockerfile is merely a marker, that a path is supposed to be used as volume. If no volume is mapped against that container path during runtime, an anonymous volume will be created and used. Unlike the bind you configured, an anonymous volume can be listed by docker volume ls, the same way named volumes are listed. The error message you shared is a runtime error message, not a build error message, as docker compose doesn’t build images when they already exist, unless you append --build to the command or explicitly use docker compose build.

If you feel something is a bug, you can always create an issue in the respective project.

For docker daemon:

For docker compose: