Search code examples
dockervue.jsdocker-composedocker-desktop

Cannot connect to docker container (localhost) MAC m1 ARM


I am running a vue application, after running and building without problems i try to connect to the application that is being run on localhost:8080. I cannot find the application. I have tried several things but none working. Any suggestions? What do you need from me. Ask and ill will update my question.

******* Docker Compose yaml file

    version: '3'
services:
  servicehub_backend:
    build:
      context: ../servicehub-backend
      dockerfile: Dockerfile-hotswap
    user: "${MYUID}:${MYGID}"
    network_mode: host
    volumes:
      - "../servicehub-backend/:/opt/app-root/"
  servicehub_front:
    build:
      context: .
      dockerfile: Dockerfile-hotswap
    user: "${MYUID}:${MYGID}"
    network_mode: host
    volumes:
      - "./:/opt/app-root/src/"

Solution

  • You need to forward traffic from a port on your machine to port 8080 in the container (docker compose ports). In your client add

        ports:
          - "8080:8080"
    

    Then you contact the container on localhost:8080.