Docker unable to mount bind letsencrypt folder

Hey there,

Running a fresh Ubuntu 23.10 install, with Docker Desktop v4.26.1 using the DEB package on docs.docker

I’m trying to host a .NET/React site inside a docker container. When trying to run the container it complains about not having access to the certificates. I’m trying to fix this by mounting the /etc/letsencrypt/live/{domain} and /etc/letsencrypt/archive/{domain} folders.

When trying this via the Command Line with the following command:
docker run --rm -it --mount type=bind,source=/etc/letsencrypt,target=/https --entrypoint sh {image}:latest
(I know that’s not the right command for my initial purpose, but I’m trying to troubleshoot this issue)
I get the following error:
docker: Error response from deamon: invalid mount config for type "bind": bind source path does not exist: /etc/letsencrypt.

When instead attempting to bind /etc the bind succeeds, but when looking at the file view, the /letsencrypt directory is not visible (as are a decent number of other files and directories)

I don’t believe it is a permission error, as the directory has 755 permissions (but it also wasn’t available when I set it to 777 for a test)

Any suggestions on how to deal with this issue, or alternative routes to make the certificates available to the container?

Thanks in advance!

Since Docker Desktop runs a virtual machine for your containers (yes, even on Linux), you probably mounted /etc from the virtual machine. That’s why the letsencrypt folder didn’t exist as it is on your host, not in the VM.

I don’t use Docker Desktop on Linux, only Docker Engine (running in Docker Desktop as well) so I don’t know the right way to allow mounting /etc from the actual host. I guess there should be a settings tab to add shared folders. On macOS it is in

Settings » Resources » File sharing

That solved the issue, thank you very much!