I'm having a problem mounting a file through volume using docker-compose. When mounting on local machine there's no errors occuring, but when mounting is happening on gitlab executor the file mount is failing. If the path is replaced as folder the error dissapears.
NOTE: The ${FILES_DIRECTORY} is absolute path.
This works (using folders instead files):
volumes:
- type: volume
source: ${FILES_DIRECTORY}/uploads
target: /usr/local/etc/php/conf.d/uploads
- type: volume
source: ${FILES_DIRECTORY}/test
target: /var/www/html/test
This fails (using files directly):
volumes:
- type: volume
source: ${FILES_DIRECTORY}/uploads.ini
target: /usr/local/etc/php/conf.d/uploads.ini
- type: volume
source: ${FILES_DIRECTORY}/wp-config.php
target: /var/www/html/wp-config.php
Fail log:
ERROR: for wordpress_sandra Cannot start service wordpress: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\"/var/www/html/sandra/wp-config.php\\" to rootfs \\"/var/lib/docker/overlay2/6cbe5f406a887cabfc1b42303f2469fe61de263e9a769192a82bfbe5753e5d5f/merged\\" at \\"/var/lib/docker/overlay2/6cbe5f406a887cabfc1b42303f2469fe61de263e9a769192a82bfbe5753e5d5f/merged/var/www/html/wp-config.php\\" caused \\"not a directory\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: for wordpress Cannot start service wordpress: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\"/var/www/html/sandra/wp-config.php\\" to rootfs \\"/var/lib/docker/overlay2/6cbe5f406a887cabfc1b42303f2469fe61de263e9a769192a82bfbe5753e5d5f/merged\\" at \\"/var/lib/docker/overlay2/6cbe5f406a887cabfc1b42303f2469fe61de263e9a769192a82bfbe5753e5d5f/merged/var/www/html/wp-config.php\\" caused \\"not a directory\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type