Docker Community Forums

Share and learn in the Docker community.

HTTPS configuration error

I use a let’s encrypt certificate, is it bad ?

I tried to do as you said, to map the port 443 to 8443 but I always get the connection closed error. I EXPOSE 8443 and use the 443:8443 mapping. I’m sure I’m missing something but can’t put my finger on it.

your app is listening on 443 in the container…

so, your port mapping should be the other way.

expose 443

then -p 8443:443

the first number is the host port, the second number is the container port

Sorry this is just me being bad, but how can I use docker run -p 8443:443 with docker-compose ? I specified the ports in my config but this has not changed the error. ?

I exposed port 443 and used 8443:443 as the ports in my docker-compose.yml

docker compose help says

ports:
  - 8443:443

#https://docs.docker.com/compose/compose-file/#endpoint_mode

also see compose ‘expose’ for the service container port 5001

expose
Expose ports without publishing them to the host machine - they’ll only be accessible to linked services. Only the internal port can be specified

That’s what I have in my configuration but I always get ERR_CONNECTION_CLOSED.

I can update the docker-compose.yml if you want

so… it sounds like the node app in the container is having trouble…

i personally would do this without compose first to make sure everything works. (and it makes sure you know how all this works)…
docker ps will show u running container ids
anyhow… you should be able to docker exec (front_end_containerid) ps -ef
to see what is running, and docker attach containerid to give u a commandline to explore what is going on

maybe the node app didn’t start?

Executing docker exec xxx ps -ef for the front gives me (amongst other lines) this :
root 15 5 0 13:47 ? 00:00:00 sh -c yarn && ./node_modules/@angular/cli/bin/ng serve -dev --public-host my_host:443 --host 0.0.0.0 --disable-host-check -ec

I think it means that the angular app started and is running. According to the logs, there is no error while running the yarn or npm docker commands.

and docker inspect containerid should show the expose and port mapping

I don’t know how to debug the node app…

i would put curl on the container as part of the build and use docker exec to try to pull content from inside the container on port 443, make sure that works

Hmmm. inspecting the front end container gives :

"Ports": {
     "8443/tcp": "null"
}

did u put expose 443 in the front end dockerfile and rebuild that image?

Yes, I did remove and rebuild the image

and if you do docker inspect on the image do you see the expose?

Well I do but this is not the same as my Dockerfile. I specified EXPOSE 443 yet I see :

"ExposedPorts": { 
    "8443/tcp": {}
},

EDIT : nevermind, the port 443 is exposed, my bad

but not mapped during run time with the compose front end info

ports:
- 8443:443

You mean that the ports I specified in the docker-compose.yml are not correctly mapped ?

your output of the docker inspect command of the running front end container says that its 443 is not mapped to the host 8443
on one of my running containers this inspect shows

            "Ports": {
                "22/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "224"
                    }
                ],
                "443/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "4435"
                    }
                ],
                "80/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "8097"
                    }
                ]
            }

the first in each is the container port

and the docker inspect of the image shows

            "ExposedPorts": {
                "22/tcp": {},
                "443/tcp": {},
                "80/tcp": {}
            },

I edited my docker-compose.yml file and now I have :

"Ports": {                      
    "443/tcp": [                
        {                       
            "HostIp": "0.0.0.0",
            "HostPort": "8443"  
        }                       
    ]                           
},

ps : sorry for the delay, I had to wait 2 hours for Discourse to let me post again

not in compose file… that is the output of docker inspect dontainer_id (of the running container)

in the docker compose it should be
Ports:

  • 8443:443

if so, then your https://localhost:8443 should work

Yes sorry, I formulated it badly, this is indeed the output of the running container. But this doesn’t change a thing :confused:

Hi,

ERROR => Loading of SSL library failed NO SSL available

As I said, please verify that all steps in the links I provided to you are completed.

This error also tells you that the SSL configuration is not properly done. FaceTime

Regards,
Luca