Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
Error: connect ECONNREFUSED 0.0.0.0:8000 when making call form one container to another

I have very simple django rest app and cucumber tests (written on JS) which has to test the rest endpoints. I'm trying to create container for rest app and when it is running, I want to create another container for the tests which has to make calls the the rest ednpoints (running from the first container) but then I getting this error connect ECONNREFUSED 0.0.0.0:8000 for each test. Here is my Dockerfile for rest app

FROM python:3.8
ENV PYTHONUNBUFFERED=1
RUN mkdir -p /app/src
WORKDIR /app/src
COPY requirements.txt /app/src
RUN pip install -r requirements.txt
EXPOSE 8000
COPY . /app/src 

And here is my cucumber test Dockerfile

FROM node:12
WORKDIR /app/src
COPY package*.json ./
RUN npm install
COPY . .
CMD ["yarn", "cucumber-drf"]

Here is my Docker-compose file

version: "3.8"
services:
  test:
    build: ./cucumber_drf_tests
    image: cucumber_test
    container_name: cucumber_container
    ports:
      - 8001:8000
    depends_on:
      - app
  app:
    build: .
    image: app:django
    container_name: django_rest_container
    ports:
      - 8000:8000
    expose:
      - 8000
    volumes:
    - .:/django #describes a folder that resides on our OS within the container
    command: >
      bash -c "python manage.py migrate
      && python manage.py loaddata ./project_apps/fixtures/dummy_data.json
      && python manage.py runserver 0.0.0.0:8000"
    depends_on:
      - db
  db:
    image: postgres
    container_name: postgres_db
    ports:
      - 5432:5432
    volumes:
      - ./data/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

And i give example with one of my test calls

When('I sent a get request to {string}', async function (path) {
this.res = await axiosInst.get('http://app:8000', config.user);
this.getUserData = this.res.data;

});

But for some unknown reason it is trying to connect to 0.0.0.0:8000. If I run the tests locally they pass. Please help!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda