Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

I'm trying to connect a ASP.NET Core container to PostgreSQL official container using Docker-Compose, I've name my container as aspnetcore-postgres and it contains in the configuration the connection string points to the PostgreSQL container as:

User ID=postgres;Password=5432;Host=localhost;Server=localhost;Port=5432;Database=ApplicationDbContext;Pooling=true;

And I use the following compose file for connection:

version: '2'

  services:

   web:
     image: aspnetcore-postgres
   ports:
     - "5000:5000"
   networks:
     - aspnetcoreapp-network

   postgres:
    image: postgres
   environment:
     - "POSTGRES_PASSWORD: 5432"
   networks:
     - aspnetcoreapp-network
   ports: 
     - "5432:5432"

   networks:
      aspnetcoreapp-network:
         driver: bridge

Whenever I try to run docker-compose up, the web application can't recognize the database container. Eventually, I only see the Postgres container in the network not the web application container. I'm using Docker for Windows RC4.

Anyone can recognized that where I'm doing the wrong step?

share|improve this question
    
Any errors coming from docker? – Brad Jul 30 at 8:15
    
No, I do not see any error from Docker. – Janshair Khan Jul 30 at 9:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.