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.

  • Can't ping docker IPv6 container
  • How can I run a docker container on localhost over the default IP?
  • Connecting to localhost mysql server from inside docker container on macOS
  • Docker container without isolation? For host system information collecting
  • How to run *BSD OS on Docker?
  • How to write a kubernetes pod configuration to start two containers
  • 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
    

  • Is using phusion/baseimage still worth it? [closed]
  • Bitbucket Pipelines - access to another container
  • docker not working after update
  • Could not connect to Redis at 127.0.0.1:6379: Connection refused in docker
  • Docker cloning - permission denied
  • Where is my data located when I backup a docker container volume?
  • 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.