skip to Main Content

I’m trying to run the portainer docker with tls. This is my docker command:

> docker run -d -p 9443:9443 -p 8000:8000 
>     --name portainer --restart always 
>     -v /var/run/docker.sock:/var/run/docker.sock 
>     -v portainer_data:/data 
>     -v certs:/certs 
>     portainer/portainer-ce:2.11.0 --sslcert ~/certs/portainer.crt --sslkey ~/certs/portainer.key

The output of docker logs portainer is:

level=info msg="2022/02/01 21:04:04 failed copying supplied certs: File doesn't exist"
level=info msg="2022/02/01 21:04:06 failed copying supplied certs: File doesn't exist"
level=info msg="2022/02/01 21:04:07 failed copying supplied certs: File doesn't exist"
level=info msg="2022/02/01 21:04:09 failed copying supplied certs: File doesn't exist"
level=info msg="2022/02/01 21:04:10 failed copying supplied certs: File doesn't exist"
level=info msg="2022/02/01 21:04:13 failed copying supplied certs: File doesn't exist"
level=info msg="2022/02/01 21:04:17 failed copying supplied certs: File doesn't exist"

I have generated the cert with:

openssl genrsa -out portainer.key 2048
openssl ecparam -genkey -name secp384r1 -out portainer.key
openssl req -new -x509 -sha256 -key portainer.key -out portainer.crt -days 3650

In desperation I copied the two files everywhere. I have added and copied these 2 files portainer.key and portainer.crt into the directories:

~/certs/

~/certs/certs

~/local-certs/certs/

~/local-certs/

~/var/lib/docker/volumes/certs/

~/var/lib/docker/volumes/certs/certs

I don’t see why it doesn’t find the certs?

Yes, I have many duplicate files everywhere now. But this is only for the test. Ofcourse I will delete and tidy up the filesystem after that.

2

Answers


  1. if you don’t have to use ssl in your system, you can remove ssl parts which included by your command and try it again without ssl parts.

    Login or Signup to reply.
  2. Look at the docs again. the certs need to be inside the container and are mounted via -v

     -v /path/to/your/certs:/certs 
    portainer/portainer-ce:2.11.1 --sslcert /certs/portainer.crt --sslkey /certs/portainer.key
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search