Tomee and Postgres communication with Docker

I have 2 Dockerfiles, one for tomee and another one for Postgres:

  1. Postgres:

  2. Docker - Does the container OS need to be same as Host OS
  3. How to solve “shell request failed on channel 0” on RHEL container?
  4. Understanding docker diff
  5. pandas to_hdf function get Illegal instruction
  6. Docker hub/registry automated build from github build details log
  7. Changing Locale in Docker Stops Many Commands From Executing?

  9. Tomcat:

After the creation of the image (postgres-img and tomee-img), I run the containers in this way:

docker run -p 5432:5432 -e POSTGRES_PASSWORD=postgres --name= postgress postgres-image

and then tomee

docker crete -p 8080:8080 --link postgress:postgress --name=tomcatt tomee-img

When I start the containers all work, I can see the web application from browser at and I can see the remote db on PGAdmin by using the ip

As you can see, I link tomee to postgress with –link so in tomee.xml I set jdbc:postgresql://postgress:5432/postgres
because I saw that after the linking you can use the alias you choose.
I saw this solution in this thread: Docker Tomcat container unable to access Postgres container

The problem is that the web application does not communicate with the db that remains always empty. It’s like the tomee.xml is useless.

Is there another way to connect the containers?

  • how to redirect docker logs to a single file?
  • After update, can't make requests in flask running in docker but can ping
  • How to wait for an etcd variable is set before starting the unit/service
  • Error accessing cgi script inside Docker container, Operation not permitted: Couldn't bind unix domain socket
  • Could not install mysql-server inside docker container
  • Unable to ssh localhost within a running Docker container
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.