I want to create a Docker image which contains Java and PostgreSQL. I just want to create an Image to reuse it from anywhere

I want to create a Docker image which contains Java and PostgreSQL. I just want to create an Image to reuse it from anywhere.

From reading the documentation I don’t understand how I can do that.

  • Is it necessary to use Docker in Java?
  • x509 certificate signed by unknown authority on Docker 1.3.2 rhel 7 host
  • Setup local WordPress development environment with Docker error 500
  • How does .NET Core on Linux determine what port a SQL Server instance listens on?
  • Docker-Compose persistent data MySQL
  • Why isn't docker commit saving data in my mongo database container?
  • This is what I tried:

    user@host:/$ docker run -i -t debian /bin/bash 
    root@container:/$ apt-get install postgresql-9.3
    user@host:/$ docker ps 
    user@host:/$ docker commit <CID> username/postgresql
    

  • Docker raise an error when tried to create a data volume
  • How to create User/Database in script for Docker Postgres
  • Docker swarm cluster and elasticsearch, using constraints to bind a service to a specific node
  • Can't use 127.0.0.1 to connect mysql server docker container, but can use IP?
  • Unable to register docker selenium remote node to selenium hub remote host with docker
  • How can I increase gitlab CE lfs file size limitation as to not get 500 server errors?
  • One Solution collect form web for “I want to create a Docker image which contains Java and PostgreSQL. I just want to create an Image to reuse it from anywhere”

    Why reinvent the wheel ? If you look at the registry, it already exists, see
    https://registry.hub.docker.com/u/alinous/docker-java-postgresql/
    Another way, you can also add PostgreSQL to a Java container, like this one
    https://registry.hub.docker.com/u/dockerfile/java/ or add Java to a PostgreSQL container…

    so start your Dockerfile with from dockerfile/java

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.