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 does not set the RAM via docker run command
  • Jenkins Slave can't read settings.xml
  • Do Docker support 32 bit ubuntu(12.04) or suse OS in future?
  • Access environment variables passed in docker run from supervisor child process
  • Is a traefik config with both docker swarm and consul backend possible?
  • Using Docker through proxy ssh error
  • Could number of docker containers be limited by file IO inside containers?
  • selinux issues with Openshift 3.4 with dynamic persistant volumes using glusterfs
  • Should the docker production image needs code as volume or not
  • Docker mount namespace
  • Docker images for application packaging
  • How to run a docker containter linked to a previously created volume
  • 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.