Docker Community Forums

Share and learn in the Docker community.

Lost ability to map to any port except 80

OS: Mac Catalina 10.15.4
Docker Desktop: 2.2.0.5 (43884)

Problem: cannot access pages hosted in any containers (started from docker run or compose file) on any port expect 80.

Expected: Map almost any port for local use. (1000, 3000, 4000, 8080, 8123, 443, 32167)… nothing works.

Steps to reproduce:

  1. Run “docker run -d -p 80:80 docker/getting-started” - open default web page from docker desktop link
  2. Run “docker run -d -p 8080:8080 docker/getting-started” - open default web page from docker desktop link
  3. Try other ports.
    Only the :80 page will open, the rest get: Connection refused.

more info: I ran tons of tutorials and created and removed lots of apps and containers on many ports. I wound up bricking the installation and had to forcibly remove it. it’s been installed and uninstalled multiple times since.
I strongly suspect that something is left over… already uninstalled and reinstalled Docker multiple times. Im confident I could start over on a clean machine and all would work well, but would love to fix this install.

Thanks!

Additional info:
Just reinstalled a new Mac OS on a different partition. Added ONLY docker. Ran 1 compose script, which initially ran fine on my other partition:

version: ‘3’
services:
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant:stable
ports:
- “8123:8123”
volumes:
- .:/config
environment:
- TZ=America/New_York
restart: always
network_mode: host

Ran: curl http://localhost:8123

result:
Failed to connect to localhost port 8123: Connection refused

Thanks!

its working - I didn’t need the ports and network_mode specified at the same time.