Hasunohana
Hasunohana

Reputation: 615

Problems to access a recent a vue app deployed in docker container

This is my second VUE web application deploy which I can't access. Inside Docker host Linux running curl localhost:8081, curl: (56) Recv failure: Connection reset by peer

Dockerfile:

FROM node:12

WORKDIR /app_teste

COPY package*.json ./

RUN npm --version

RUN npm install

COPY . .

EXPOSE 8081

CMD ["npm","run","serve"]

dockercompose.yml:

version: '3'
services:
  website:
    build: .
    ports:
      - "8081:8081"
    container_name: dexter_g_website

I was reading here some topics similars which says about binding to 0.0.0.0 would work, however it never happens. Anyone can help/suggest anything?

docker port dexter_g_webiste

8081/tcp -> 0.0.0.0:8081

Upvotes: 0

Views: 608

Answers (1)

Jacob Goh
Jacob Goh

Reputation: 20845

Based on Vue CLI documentation, the default port for serve command is 8080.

If you want to serve it to port 8081, try

CMD npm run serve --port 8081

Some more debugging tips:

You can run curl command inside the docker container to debug your app.

  1. SSH into the running container
docker-compose exec -it <container_id> sh
  1. Install CURL

  2. curl the URL and see which is working

curl http://localhost:8080
curl http://localhost:8081

Upvotes: 1

Related Questions