What is the best approach to configure Docker for a webapp?

I would like to configure a Docker container for running a Java application that uses Postgres and Jetty.
What is the best approach to do this:

  1. Pull three separate containers from the Docker hub and somehow use them together.
  2. Create a Dockerfile from scratch with all configurations.
  3. Pull three images from the Docker hub and manually create a single Dockerfile from them.

  • Docker stops immediately upon running - EOF error
  • How to install the latest version of Docker on CentOS 7
  • IIS website fails to load a dll [Containers + Kubernetes]
  • How to send configurations to docker container? [closed]
  • Docker Container management in production environment
  • How to configure exim with docker for sendmail
  • Pull image from local docker registry with IP
  • Virtual Box on Windows while using Docker
  • AWS EB, Play Framework and Docker: Application Already running
  • Docker php7.0:apache : “docker-php-source: not found”
  • Issue executing python script in Docker
  • Is Docker Swarm supposed to not remove rescheduled containers when crashed node rejoins?
  • 2 Solutions collect form web for “What is the best approach to configure Docker for a webapp?”

    I’d like to point out that all three of your options are sort of valid… In your first option, that “somehow” you are referring to is the Compose. Your third option makes sense if you replace create a single Dockerfile from them with create a docker-compose.yml file for them.

    I’m throwing this out there as an answer because I think it will help understanding of how different images can work together. It seems like you were naturally looking for Docker Compose.

    A standard layout would be to use 2 containers – one for the database and one for the application (jetty with your Java application – I’m assuming it’s a WAR file)

    Both should be based on standard containers readily available on Docker Hub.

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