I am trying to run my docker container with each service on different ports, but I keep receiving an error specific to port 8000 being accessed by multiple ports when I am only using port 8000 for one service.
Everything works fine when I remove the qcluster service, but I don't understand why when its configured for port 8001 and not 80000
Here's the error message:
Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:8000 -> 0.0.0.0:0: listen tcp 0.0.0.0:8000: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
and here is the compose.yaml file:
services:
db:
image: postgres
volumes:
- ./data/db:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=***********
- SECRET_KEY=************************
- DB_HOST=*******************
- DB_PWD=****************
- DB_CERT=****************
web:
build:
context: app
command: python manage.py runserver 0.0.0.0:8000
ports:
- '8000:8000'
expose:
- '8000'
environment:
- SECRET_KEY=**********************
- DB_HOST=db.***********
- DB_PWD=***************
- DB_CERT=*************
depends_on:
- db
qcluster:
build:
context: app
command: python manage.py qcluster
volumes:
- .:/code
ports:
- "8000:8001"
depends_on:
- db
Seems that you have another container/service listening on port 8000.
Run
docker container lsand check if there are containers already listening on 8000. If so, just kill that container and try again.If there are no running container, maybe there's another service that is listening on that port. To identify it, run
to obtain its PID (a number that represent the ID of that process). Then, kill it using