I have an asp.net (version 8) webapi project that I have set up to work with docker. I have the container that runs my API and a volume where I put my database. It works and I'm able to run API endpoints to get my data from the postgresql database. I want to be able to view the database running in the volume though. How can I do this?
I'm using a Visual Studio Code plugin called PostgreSQL (Postgresql management tool by Chris Kolkman) and I can connect to the postgresql database I installed on my operating system but not the one that is running on my docker volume.
Here is my docker-compose.yml file
services:
#asp.net web application
webapp:
container_name: shop-back-api
build:
context: .
dockerfile: Dockerfile
ports:
- "5999:5999"
environment:
- ASPNETCORE_ENVIRONMENT=Development
- Database__ConnectionStrings__DefaultConnection=Host=db;Port=5432;Database=shopback;Username=postgres;Password=XXXXX
#postreSQL database
db:
container_name: shop-back-db
image: postgres:latest
ports:
- "5432:5432"
environment:
POSTGRES_DB: shopback
POSTGRES_USER: postgres
POSTGRES_PASSWORD: XXXXX
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
I also have the "Docker" extension installed and I can view my images, containers, and volumes from Visual Studio Code but I'm not sure if this can help me as it doesn't give me access to the database running on my volume.
All I had to do was uninstall the postgresql server installed on my OS and I was then able to connect to the postgresql server running on the Docker volume right away.