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.

  • Redis Sentinel manual failover command timesout
  • How to convert docker run command into json file?
  • Official Jenkins Dockerfile acting strange
  • Mount a volume while using a docker container in Azure App Service
  • ODBC Driver 13 for SQL Server can't open lib on pyodbc while connecting on ubuntu docker image
  • How to connect a service running inside a docker with consul?
  • “CMD ['/home/user/script.sh']” in docker file doesn't work with docker-compose
  • docker-compose service version error
  • Use Docker.io without the build-in NAT function but with DHCP
  • How can I link a Container Group with a Container?
  • proxypass to phpmyadmin container but got error 502 and Connection refused
  • How to find out how much RAM a docker run execution consumed at maximum?
  • 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.