Search code examples
docker-volume

docker-compose volume bug: File shows up in ls, but accessing it says that file doesnt exists


I'm trying to mount some certification files from letsencrypt. They are sudo protected (need sudo access), however, since docker has sudo access, that shouldnt be the problem. When I bash into the container, and go into the mounted folder inside the container, the files show up in the ls command, however, cat-ing the files tells me that said files doesn't exists. When I run the container normally, geoserver says that it cant find the certificate/private key files and generates its own self-signed certificates.

version: '3'

services:
        geoserver:
                container_name: geoserver
                image: "kartoza/geoserver:2.22.0"
                volumes:
                        - ./geoserver-data:/opt/geoserver/data_dir
                        - /etc/letsencrypt/live/geo.geplant.com.br:/etc/certs
                ports:
                        - 0.0.0.0:8080:8080
                        - 0.0.0.0:443:8443
                restart: always
                environment:
                        - GEOSERVER_ADMIN_PASSWORD=
                        - GEOSERVER_ADMIN_USER=
                        - GEOSERVER_DATA_DIR=/opt/geoserver/data_dir
                        - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc
                        - SSL=true
                healthcheck:
                        test: curl --fail -s http://localhost:8080/ || exit 1
                        interval: 1m30s
                        timeout: 10s
                        retries: 3

Inside the containers mounted volume: enter image description here t Cat'ing the file enter image description here

I think this is some sort of protection going on, bc the README file works just fine.


Solution

  • I found the answer. The problem was that the certificate files were only symlinks.

    enter image description here