I have been hammering at this for hours. I’m running windows 11, I have installed Docker Desktop 4.21.1 (114176). I started the tutorial process and had trouble right out of the gate. Following the “What is a container?” tutorial, The Welcome-to-Docker container gets automatically added and they tell you to open the frontend to take a look. All I get is
This site can’t provide a secure connection
localhost sent an invalid response.
I read things through the googs about a docker-compose.yml and some problem with nginx settings, but I can’t seem to find any of it. Can someone point me in the right direction?
No one has any insights on this? Sad face, I wanted to learn Docker.
Unfortunately I have less time recently and I miss a lot of questions, but thank you for not giving up and trying again.
Since I can’t check the tutorial now, can you share the steps here or a link a website if there is one? I’m surprised by the SSL error as I find it unlikely that the “welcome” tutorial would use SSL at all.
No worried, I understand crowded schedules all too well. Thank you for taking a look. I decided that It may be easier if I did a screen recording and threw it up on youtube. Here’s the link to the video:
I’m just genuinely confused about this.
If you need to see any files let me know.
Thanks for the recording. I will get back to you after work or when I have time.
I like that when I watched your video and thought you should try something you did exactly that at the next second.
I found out I could try the tutorial on my Mac. I didn’t notice the “What is a container” button when I first checked the dashboard. It worked for me so my guess now is that it is either a bug on Windows or more likely you have something else running on that port which redirects you to HTTPS. Since it doesn’t work, I don’t know why it would happen.
There is a description on Docker hub: https://hub.docker.com/r/docker/welcome-to-docker with a link to GitHub as source of the image, but that GitHub repo has two branches. The main branch is clearly not the current source since that builds a nodejs image while the “small-image” branch uses Multi-stage build which means it copies the built static html files to an nginx image. There is no SSL anywhere in that code.
Now you could ask how the hell could run something on that port if the container was able to run and listen to the same port. The fact is that Docker Desktop is a special environment and the container listens on the port inside the virtual machine of Docker Desktop. I noticed that sometimes a container starts even if the port on the host is not available so the only thing that will be missing is the port forward from the host machine into the virtual machine.
So this is my guess now. My first guess was that you ran an app on localhost that required SSL before and the browser stored the permentant redirect information in the cache, but then you just tried it from another browser.
Have you tried to delete the welcome container and access
localhost:8088 when it shouldn’t redirect since the container is not running?
If you confirm my guess, you have two options. You find out what is running on that port, stop it and restart the tutorial, or you try this command from a terminal (powershell or command line):
docker run -d -p 8089:80 --name welcome-to-docker docker/welcome-to-docker
As you can see I replaced port 8088 with 8089 so assuming that port is not used on the host, the container would be accessible from the browser. Than you can go back to Docker Desktop and continue with the tutorial since the next steps I saw don’t require doing anything in the broswser. It will basicaly show you this webpage:
and Docker Desktop shows you how to get more information about the container
Success! I found the problem!
So, While trying to follow your advice, I went to
http://localhost:8088 while the container was stopped. I received an “error connection refused” which made sense, but it was still shunting me over to https. I then went to port 8089 and got the exact same result. I then started the container and tried both ports. This gave me the same ERR_SSL_PROTOCOL_ERROR on 8088, but “Error Connection Refused” on 8089
Out of the interest of curiosity I opened Firefox this time (something I should have thought of before.) and it worked! The container opened and I got my congratulations!.. so… why?
[One Google Search Later…]
Well, when I opened up two browsers in my video, I had chosen Brave and Edge, which both run on Chromium. if I had used google chrome I probably would have gotten the same result. Turns out, Chromium has a cache I wasn’t aware of called HSTS.
FROM How to Stop Chrome from Automatically Redirecting to https - Howchoo
" What is HSTS?
According to Google Chrome, an HSTS is HTTP Strict Transport Security—a way for sites to elect to always use HTTPS."
All I had to do was navigate to
chrome://net-internals/#hsts in the browser I was using, put localhost in the field for “Delete Domain Security Policies”, and hit the delete button. According to some sites, you may also have to delete the site data from the normal browser cache, but I didn’t have to do so in this instance.
Thank you so much for taking the time to help me figure this out. I was about ready to write off Docker for another while, but now I get to learn and play with it properly! I hope you have a Wonderful day!
Interesting. I use Chrome too, but when I checked the net-internals link you shared there was nothing added there, yet I have never had this issue, but thank you for sharing your solution. I’m sure it will help others as well!