Search code examples
dockermacosdocker-composedocker-desktop

Cannot connect to docker compose containers on Mac


When I run docker-compose up and try to connect via the docker address IP shown in inspect or docker desktop, it doesn't connect

after some investigation it seems I should publish or bound the docker port with mac localhost, but I can't the right commend to do with docker-compose

container

enter image description here

Not bounded

commend to connect to VM containers of docker compose from mac localhost


Solution

  • You need to bind/expose the inner port (:3000) in the container to the host.

    In your docker-compose.yaml file include:

    ports:
    - "3000:3000"