Docker problem - Springboot container can't retrieve data from PostgreSQL container - postgresql

i have very strange truble with Docker containers communication, here what i did:
1)I configured a Docker bridge network
2)I created PostgreSQL image and started it in bridge network (same of step 1)
3)I connected and filled PostgreSQL container with data using DBeaver from the host.
4)I created and started SpringBoot app container inside the bridge network. The SprigBoot app container connects correctly with PostgreSQL container.
Here's the problem: i can retrieve all data i want from PostgreSQL container using Dbeaver on same host or using my not-conteinerized SpringBoot app. But i can't retrieve data from the same PostgreSQL container using SpringBoot app container (in the same bridge network described in step 1).
It looks like SpringBoot app container can access only table's structures but it can't access data.
-I tried to modify postgresql conf allowing access from all hosts

I solved the problem my own and here is the solution:
Even though I started the docker postgres:12 image the default postgres server that was being started was v15. I noticed this problem by doing "test connection" from DBeaver. For this reason i could see only table's structures but can't access data. I solved the problem uninstalling Postgres server v15 (I was not using it) so the default version became v12.

Related

Why I see different data between postgres DB running in docker and postico from main host?

I am using docker container for postgres database, from UI which is powered from postgres. I deleted an entry from postgres via postico(client for postgres in mac), now when I see my database in postico is completely empty but when I refresh the UI, I still see the data!!!
Please correct me If I am postico is just the UI to see what is in the postgres running in the container, In that case I expected UI also to be empty but it is not the case.
Can someone tell me why my expectation is going wrong and please let me know if any info is needed?

Externalization of postgreSQL database from windows comtainer

I have an APP running inside container on windows 2016 platform . The app uses the postgreSQL database .we want to persist the database when container destroy and another container up again . So we want to persist the database record . I see the postgress container for Linux platform but not for windows container .We are using window server core image as base . Can someone suggest how can we persist database info.
Thanks
Ravi
The program will run in the Windows container. The DB will run in a Linux container. Since they're in different containers, the OS needn't be the same. You'll simply be connecting to the DB over a URL in a network.

Docker postgres how to share database

I'm running a PostgreSQL db via docker postgres.
I have populated the db with lots of data and would like to share it with others.
Is there a way to 'save' this database with all the data as a new image and publish it to a Docker registry so it can be easily pulled and used?
You can use docker container commit https://docs.docker.com/engine/reference/commandline/commit/ to create an image from a container.
Then you can publish that image to a docker registry for use by others.

Using Docker and MongoDB

I have been using Docker and Kubernetes for a while now, and have set up a few databases(postgres and mysql) and services.
Now I was looking at adding a mongoDB, but it seems different when it comes to user management.
Take for example postgres:
https://hub.docker.com/_/postgres/
Immediately I can declare users with a password on setup and then connect using this. It seems the mongo image does not support this. Is there a way to simply declare users on startup and use them similar to the postgres setup? This is, without having to exec into the image, modify auth settings and restarting the mongo service.

How to connect a running container(tomcat) on amazon ec2 to RDS postgres

In aws, I have an amazon linux instance running with docker installed and my app running as a container. It's running in tomcat. However I need to connect it to my database.
I have made this work with a postgres container earlier doing this:
docker run --link <dbcontainername>:db -P -d tomcat-image
But to have the database more reliable it is wanted to use amazon RDS instead.
I have created a VPC with two subnets which both the instance and the RDS uses
And they are also both in the same Security Group.
I am able to access the tomcat fine through the public ip, but it throws errors because it isn't connected to the db.
Networking is not my strong suit, so there might be something there I am missing, but I find it hard to find any text describing this process without mentioning Elastic bean stalk.(It is my impression that it should be possible to do everything EBS does, manually)
There's a similar question asked here about 8 months ago, but he didn't get any responses so I'm trying again.