Running Tomcat with PostgreSql using Dockerfile

I want to run a Tomcat with PostgreSql database within the same Dockerfile.

I have the following Dockerfile

  • Docker for windows 7- Get https://registry-1.docker.io/v1/repositories/library/hello-world/tags/latest: x509: certificate signed by unknown authority
  • Error while pushing a Docker image into Cloud Foundry
  • Mounting local volumes to docker container
  • Docker volumes binding: container to host
  • Install Fabric8 on openshift docker instance
  • gitlab can not change gitlab url ,i edit config,yml , gitlab.yml
  • FROM tomcat:8-jre7
    
    MAINTAINER "Sonam <mymail@gmail.com>"
    
    RUN apt-get -y update
    
    Add simplewebapp.war /usr/local/tomcat/webapps/
    
    RUN apt-get update && apt-get -y upgrade
    
    FROM postgres
    

    When I run the docker image, I can’t access the Tomcat like I could if I comment out the postgres. How do I get Postgres running and Tomcat too?

    thanks

  • How to setup PyCharm for Docker inside Vagrant?
  • How to measure linux bridge overhead (cpu usage)
  • Varnish/Symfony3 Cache on Nginx - Ago 0 on caching
  • Docker Compose how to extend service with build to use an image instead
  • Access source container from recipient container
  • Docker container shows running even after exit command
  • One Solution collect form web for “Running Tomcat with PostgreSql using Dockerfile”

    You can only take one image as your base, just the same as you can only have one OS installed.

    If you need to have two applications installed, then you need to build your own container – either starting from one and running the sequence of commands in the Dockerfile you need to install the other app, or just start from a base OS image, and install both.

    Alternatively – why do you need them in the same container? Something like --link might do what you want, more effectively. Just run two containers, and link them.

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