2

I'm using docker compose to run a simple web server project I created. This configuration has been working fine for months but suddenly stopped working after I haven't been to the office for two weeks.

It works when I map my ports like that - 8080:80, but I don't want to have to type out port 8080 every time. I used netstat -a -n -o | findstr /c:80 to find the process ID of the process listening to port 80, and tasklist /fi "pid eq 4" to find out what the name of the process is.

Turns out it's some system process, so I'm not sure what to do about that. I've uninstalled Skype and checked that the World Wide Web Publishing Service isn't turned on. Does anybody have an explanation or ideas as to how to fix this?

Thanks in advance.

update

when I run net stop http and kill all dependant services with it, port 80 is free. Services being stopped: Windows Remote Management (WS-Management), SSDP Discovery, Print Spooler, BranchCache and HTTP of course. Which of these could be the culprit?

update 2

I now stopped those services one by one, and after stopping every one of those it seems BranchCache is responsible for this. more testing ensues

docker-compose.yml

version: "3"
services:
  vote-client:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "80:80"

Dockerfile

FROM nginx
COPY ./html /usr/share/nginx/html

when I run docker-compose up this is my output:

docker-compose up --build
Removing vote-client_vote-client_1
Building vote-client
Step 1/2 : FROM nginx
 ---> 42b4762643dc
Step 2/2 : COPY ./html /usr/share/nginx/html
 ---> Using cache
 ---> a1aade2a299e
Successfully built a1aade2a299e
Successfully tagged vote-client_vote-client:latest
Recreating c2654f31dcff_vote-client_vote-client_1 ... error

ERROR: for c2654f31dcff_vote-client_vote-client_1  Cannot start service vote-client: driver failed programming external connectivity on endpoint vote-client_vote-client_1 (2188c8607a04ba2388a661504601431d6b30825d595dafae0c318f2d2b5685b0): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error Permission denied

ERROR: for vote-client  Cannot start service vote-client: driver failed programming external connectivity on endpoint vote-client_vote-client_1 (2188c8607a04ba2388a661504601431d6b30825d595dafae0c318f2d2b5685b0): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error Permission denied
ERROR: Encountered errors while bringing up the project.
lenny
  • 734
  • 2
  • 15
  • 43
  • run as sudo since ports <1024 are protected – Marc Sances May 02 '19 at 12:18
  • @MarcSances I'm on windows, and I've already tried running PowerShell as admin and then running `docker-compose up`. I never had to run it as admin before, so I don't see why I should have to now. – lenny May 02 '19 at 12:33
  • try then `netstat -a -b` to see the process that has opened that port – Marc Sances May 02 '19 at 12:34
  • So you already have your answer – doesn't work because there is another application that occupies this port. We could maybe help you if you tell us what "some system process" exactly is. – bellackn May 02 '19 at 14:01
  • @bellackn it's PID 4, named "System" and all I can find out is that it apparently handles IO such as USB and HDD access. I have no idea why it would need port 80, and I'm completely clueless as to why it started having this issue out of nowhere. As noted, I've tried disabling some features that come with windows. I've made sure there is no IIS or World Wide Web Publishing Service installed (doesn't show up in computer management and is unchecked in the Windows feature window), and I've uninstalled Skype, just to make sure. How could I go about finding out more about that process? – lenny May 03 '19 at 07:18
  • Well I am using docker, duh, but other than that not that I'm aware of. All the Hyper V services are stopped as well. – lenny May 03 '19 at 07:43
  • 1
    Can you bring your PC in a state where it wouldn't be fatal if it crashed? If yes, then I'd suggest to just kill this process and see what happens (on your own risk, of course. ;)). Also, maybe [this](https://superuser.com/questions/352017/pid4-using-port-80) and maybe [this](https://stackoverflow.com/a/48343508/6482759) could help you. – bellackn May 03 '19 at 07:45
  • It seems like @bellackn links should get your problem solved. Some other service should probably be stopped as a first resort before killing pid 4 directly. – RichS May 03 '19 at 08:10
  • @bellackn I'm not sure, what's the worst that could happen? Could I brick anything by doing so? Or are you just saying I should save all my files before trying that? Also, I'm not just interested in fixing the problem only on my machine, I want to be able to drop this software on any PC and run it without having to edit the registry or some other wonky stuff. I'd like to understand what service is doing this and disable it the proper way, if there is one. I'm looking into disabling the HTTP.sys driver (not sure if thats correct terminology but that's the way it was stated in bellackn's link) – lenny May 03 '19 at 08:23
  • I don't know what could happen if you just stop it, but I wouldn't expect data loss or something. Just killing it would just be the thing I would do for testing purposes. Have you tried running your containers on another Windows machine? Maybe it is just something weird about your specific host, you never know... – bellackn May 03 '19 at 09:18
  • @bellackn okay so after some more digging and poking I found out the problem goes away when I kill the BranchCache service. Also, I realized that this is abnormal behavior: I get [a simple 404 page](https://i.stack.imgur.com/Y36vb.png) when executing a HTTP GET on localhost using my browser. Any ideas? – lenny May 06 '19 at 07:30
  • You get a 404 _after_ stopping the BranchCache service? Then it seems like it is not the culprit, as there still seems to be another service that returns this 404. What about setting this service (and possibly others) to "Manual" startup? Unfortunately, I'm not very familiar with advanced Windows internals, let's hope somebody else with more experience can give us a hand here. – bellackn May 06 '19 at 07:55
  • 1
    @bellackn no, sorry for the misunderstanding. I get a 404 with BranchCache still running, but port 80 frees up and I get a (expected) "Site can't be reached" without BranchCache running. Problem is, BranchCache is set to auto start as per group policy. I just don't understand why it's a problem so suddenly, it used to work just fine... Plus I don't think it was enabled just now, BranchCache has been part of Windows since at least Windows 7 if I'm not mistaken – lenny May 06 '19 at 08:02
  • also, I just noticed, BranchCache restarts automatically even though the service is set to Manual. I smell something fishy... – lenny May 06 '19 at 08:05
  • As we talk about Windows, it could always be some crazy update that caused this. Also, maybe the GPO was altered by your admins? From a short Google journey, I can say that at least you're not the first one with this problem. Maybe [this](https://2pintsoftware.com/faq-items/can-change-branchcache-port-distributed-mode/) could help you out, but I fear you have to talk to the person that is responsible for the GPOs. – bellackn May 06 '19 at 08:08
  • @bellackn yeah, I've seen that article. I talked to the sys admins here and they claim to have changed the port, but as it states in the article, it doesn't seem you can change the port through GPOs. funnily, the GP is also preventing me from changing the port locally... either way I don't think turning off or reconfiguring the service is the right solution for me, but it might be the only one.. we'll see. now, thanks a lot for your help, but I think I'll have to move on to other issues. – lenny May 06 '19 at 08:24

0 Answers0