0

I'm using docker for the first time to set up a test database that my team can then use. I'm having some trouble getting my data on DBeaver after running my docker-compose file. The issue I'm facing is that my database does not show up in DBeaver (along with relevant Schemas and Tables that I also create/populate in my initialization sql script).

Here is my docker-compose.yml

version: "3"
services:
  test_database:
    image: postgres:latest
    build:
      context: ./
      dockerfile: Dockerfile
    restart: always
    ports:
      - 5432:5432
    environment:
      - POSTGRES_USER=dev
      - POSTGRES_PASSWORD=test1234
      - POSTGRES_DB=testdb
    container_name: test_database

In this, I specify the docker file I want it to use for building. Here is the dockerfile:

# syntax = docker/dockerfile:1.3
FROM postgres:latest

ADD test_data.tar .

COPY init_test_db.sql /docker-entrypoint-initdb.d/

Now, when I run docker-compose build and docker-compose up, I can see through the logs that my SQL commands (CREATE, COPY, etc.) do get executed and the rows do get added. But when I connect to this instance through DBeaver, I can't see this at all. In fact, the only database on there is the default Postgres database, even through the logs say I'm connected to test_database.

I followed some other solutions and used docker volume prune as well, but that didn't affect anything (I read some solutions about clearing up volumes, and at that point, I had volumes: /tmp:/tmp as well). Any ideas?

2
  • check whether the user that you are using from DBViewer has the permission to the newly created database. Commented Dec 29, 2022 at 18:53
  • @AmalGJose, when I create a connection in DBeaver I use the credentials used in the docker-compose file. Do I do something different? Commented Dec 29, 2022 at 18:59

1 Answer 1

1

Wow, this wasn't an error after all. All I had to do was go on the connection settings on DBeaver and check 'Show all databases' under the Postgres tab. Hope this can help someone :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.