skip to Main Content

I did the following:

https://github.com/dockersamples/example-voting-app

cd example-voting-app

Inside that there are number of files/folders

MAINTAINERS
LICENSE
Jenkinsfile
ExampleVotingApp.sln
README.md
docker-stack-windows-1809.yml
docker-stack-simple.yml
docker-compose.yml
docker-compose-windows.yml
docker-compose-windows-1809.yml
docker-compose-simple.yml
docker-compose-k8s.yml
docker-compose-javaworker.yml
architecture.png
kube-deployment.yml
k8s-specifications
docker-stack.yml
docker-stack-windows.yml
result
vote
worker

I did cd vote and executed following commands

docker build . -t voting-app
docker run -p 5000:80 voting-app

After I run docker run command, I see the following output, and nothing is happening . I am clueless, as there is no error messages etc.

[root@osboxes vote]# docker run -p 5000:80 voting-app
[2020-06-16 17:59:27 +0000] [1] [INFO] Starting gunicorn 19.10.0
[2020-06-16 17:59:27 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1)
[2020-06-16 17:59:27 +0000] [1] [INFO] Using worker: sync
[2020-06-16 17:59:27 +0000] [9] [INFO] Booting worker with pid: 9
[2020-06-16 17:59:27 +0000] [10] [INFO] Booting worker with pid: 10
[2020-06-16 17:59:27 +0000] [11] [INFO] Booting worker with pid: 11
[2020-06-16 17:59:27 +0000] [12] [INFO] Booting worker with pid: 12

Please guide how to fix this issue, and how to get the vote app running on container.

My OS details are as follows:

NAME="CentOS Linux"
VERSION="7 (Core)"

Thanks

2

Answers


  1. Chosen as BEST ANSWER

    After code checkout, I followed the following steps, and got the voting application to run.

    change to vote directory

    docker run -d --name=redis redis
    
    docker build . -t voting-app
    
    docker run -p 5000:80 --link redis:redis voting-app
    
    docker run -d --name=db -e POSTGRES_PASSWORD=postgres postgres:9.4
    

    change to worker directory

    docker build . -t worker-app
    
    docker run --link redis:redis --link db:db worker-app
    

    change to result directory

    docker build . -t result-app
    
    docker run -p 5001:80 --link db:db result-app
    

    Access the URLs

    http://<IP>:5000/
    
    http://<IP>:5001/
    

    Replace the IP with IP of your machine. Now I can access both the URLs.


  2. In my earlier answer, i got the app working, by building and running each image individually.

    Finally, after spending few hours, I am finally able to create docker-compose.yml file and able to run the entire application using the following command:

    docker-compose up

    Hope it helps other who are struggling to make this application work.

    docker-compose.yml

    version: "3"
    
    services:
     redis:
      image: redis
    
     db:
      image: postgres:9.4
      environment:
        - POSTGRES_PASSWORD=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    
     vote:
      image: voting-app
      ports:
       - 5000:80
      links:
       - redis
    
     worker:
      image: worker-app
      links:
        - db
        - redis
    
     result:
      image: result-app
      ports:
        - 5001:80
      links:
        - db
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search