Dockerized Backend hangs up on dockerized database

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

I’m running my containers via a docker compose file. They are in the same network and I can ping from my backend container to my database container. I use the database name as the hostname in the connection string and it doesn’t bring any errors that it couldn’t find the host. Instead, it just hangs up and times out. I have a test endpoint which is just suppose to test the connection. When you use that endpoint, database container logs “invalid packet length”, and on the frontend, nothing happens, then it times out. I have no idea whats wrong. Any help? If I only run the database via docker and the backend without, I’m able to connect via localhost in the connection string. version: ‘3.2’ services: server: restart: always build: dockerfile: Dockerfile context: ./nginx depends_on: – backend – frontend – database ports: – ‘5000:80’ networks: – app_network database: image: postgres:latest container_name: database ports: – “5432:5432” restart: always hostname: database environment: POSTGRES_PASSWORD: 1234 POSTGRES_USER: postgres backend: build: context: ./backend dockerfile: ./Dockerfile image: kalendae:backend hostname: backend container_name: backend environment: – WAIT_HOSTS=database:5432 – DATABASE_HOST=database – DATABASE_PORT=5432 – PORT=5051 frontend: build: context: ./frontend dockerfile: ./Dockerfile image: kalendae:frontend hostname: frontend container_name: frontend environment: – WAIT_HOSTS=backend:5051 – REACT_APP_BACKEND_HOST=localhost – REACT_APP_BACKEND_PORT=5051 submitted by /u/PossiblyHelpfulAnt [link] [comments]

X ITM Cloud News

Patricia

Leave a Reply

Next Post

Is my docker setup correct? I only seem to be facing errors.

Sat Aug 1 , 2020
Spread the love          My dockerfile: FROM golang:1.14-alpine RUN mkdir /app ADD . /app WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . RUN go build -o server . CMD [“./server”] My docker-compose.yml: “` version: “3.5” services: elasticsearch: container_name: “elasticsearch” image: docker.elastic.co/elasticsearch/elasticsearch:7.8.0 environment: – node.name=elasticsearch – cluster.name=es-docker-cluster – […]
X- ITM

Cloud Computing – Consultancy – Development – Hosting – APIs – Legacy Systems

X-ITM Technology helps our customers across the entire enterprise technology stack with differentiated industry solutions. We modernize IT, optimize data architectures, and make everything secure, scalable and orchestrated across public, private and hybrid clouds.

This image has an empty alt attribute; its file name is x-itmdc.jpg

The enterprise technology stack includes ITO; Cloud and Security Services; Applications and Industry IP; Data, Analytics and Engineering Services; and Advisory.

Watch an animation of  X-ITM‘s Enterprise Technology Stack

We combine years of experience running mission-critical systems with the latest digital innovations to deliver better business outcomes and new levels of performance, competitiveness and experiences for our customers and their stakeholders.

X-ITM invests in three key drivers of growth: People, Customers and Operational Execution.

The company’s global scale, talent and innovation platforms serve 6,000 private and public-sector clients in 70 countries.

X-ITM’s extensive partner network helps drive collaboration and leverage technology independence. The company has established more than 200 industry-leading global Partner Network relationships, including 15 strategic partners: Amazon Web Services, AT&T, Dell Technologies, Google Cloud, HCL, HP, HPE, IBM, Micro Focus, Microsoft, Oracle, PwC, SAP, ServiceNow and VMware

.

X ITM