Docker Community Forums

Share and learn in the Docker community.

Docker-compose up: Ports are not available: listen tcp X.X.X.X:8000: bind: The requested address is not valid in its context

Hi

I’m using Docker for deploying my Dash app with Gunicorn. If I don’t specify my IP in the docker-compose.yml it works as expected: running on localhost:8000

# docker-compose.yml
version: '3'

networks:
   myapp-network:
services:
   # main application
   myapp:
        container_name: myapp-multi
        build:
          .
       ports:
          - "8000:8000"

But I want to access the app through another IP address. I tried this:

ports:
  - "X.X.X.X:8000:8000"

I got the error:
ERROR: for myapp Cannot start service myapp: Ports are not available: listen tcp X.X.X.X:8000: bind: The requested address is not valid in its context.

What is the problem?

Thanks in advance