Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vote container not starting + fix #134

Closed
davidem opened this issue May 15, 2019 · 11 comments
Closed

Vote container not starting + fix #134

davidem opened this issue May 15, 2019 · 11 comments

Comments

@davidem
Copy link

davidem commented May 15, 2019

Description

Vote container not starting. Running latest example-voting-app on up-to-date Docker Desktop on a Mac

Steps to reproduce the issue, if relevant:

  1. git clone latest version
  2. docker-compose up --build -d
  3. docker-compose ps

Describe the results you received:
"docker-compose ps" shows "Exit 1" on vote_1 container. Rest is Up:

$ docker-compose ps
          Name                        Command               State                       Ports                    
-----------------------------------------------------------------------------------------------------------------
7_microservices_result_1   nodemon server.js                Up       0.0.0.0:5858->5858/tcp, 0.0.0.0:5001->80/tcp
7_microservices_vote_1     python app.py                    Exit 1                                               
7_microservices_worker_1   /bin/sh -c dotnet src/Work ...   Up                                                   
db                         docker-entrypoint.sh postgres    Up       5432/tcp                                    
redis                      docker-entrypoint.sh redis ...   Up       0.0.0.0:32769->6379/tcp 

'docker-compose logs' shows the following error:

OSError: [Errno 8] Exec format error

Describe the results you expected:
Well... Up instead of Exit 1 😎

Additional information you deem important (e.g. issue happens only occasionally):
I've fixed it... see below.

Output of docker version:

Client: Docker Engine - Community
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        6247962
 Built:             Sun Feb 10 04:12:39 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 04:13:06 2019
  OS/Arch:          linux/amd64
  Experimental:     true

Output of docker info:

Containers: 5
 Running: 5
 Paused: 0
 Stopped: 0
Images: 33
Server Version: 18.09.2
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 09c8266bf2fcf9519a651b04ae54c967b9ab86ec
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.125-linuxkit
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 5.818GiB
Name: linuxkit-025000000001
ID: F4NW:FVGS:ZLTR:PEZA:T625:TSHW:4PB6:XX4C:WOVM:UIGB:TWSE:NYAA
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 66
 Goroutines: 83
 System Time: 2019-05-15T21:29:37.0272169Z
 EventsListeners: 2
HTTP Proxy: gateway.docker.internal:3128
HTTPS Proxy: gateway.docker.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Additional environment details (AWS, Docker for Mac, Docker for Windows, VirtualBox, physical, etc.):
Docker Desktop on macOS 10.14.4.

The Fix
I've added a 'shebang' to 'example-voting-app/vote/app.py':

#!/usr/bin/env python2.7

Now it runs like expected:

$ docker-compose ps
          Name                        Command               State                      Ports                    
----------------------------------------------------------------------------------------------------------------
7_microservices_result_1   nodemon server.js                Up      0.0.0.0:5858->5858/tcp, 0.0.0.0:5001->80/tcp
7_microservices_vote_1     python app.py                    Up      0.0.0.0:5000->80/tcp                        
7_microservices_worker_1   /bin/sh -c dotnet src/Work ...   Up                                                  
db                         docker-entrypoint.sh postgres    Up      5432/tcp                                    
redis                      docker-entrypoint.sh redis ...   Up      0.0.0.0:32769->6379/tcp 
@davidem davidem changed the title Vote container not starting Vote container not starting + fix May 15, 2019
@davidem
Copy link
Author

davidem commented May 16, 2019

Strange, I can't seem to reproduce the error on a fresh install.

@ProsperWare
Copy link

this should be started with docker stack deploy -c docker-stack.yml app

@davidem
Copy link
Author

davidem commented Jun 7, 2019

@ProsperWare : thanks for the reply, but: I was under the impression that you can use any of the common methods to start the application (compose, stack, k8s, etc). So when I have an issue using 'docker compose', saying I need to use 'docker stack deploy' surprises me... especially when the documentation clearly states you can use either method.

Anyway: I had an issue, fixed it, thought I'd share it, but couldn't reproduce it myself on a fresh install. I'll close the case.

@davidem davidem closed this as completed Jun 7, 2019
@robeatoz
Copy link

I had the same issue on Docker for Windows and I fixed it with two changes:

@wusatosi
Copy link

I had the same issue on Docker for Windows and I fixed it with two changes:

I'm unable to fix my setup, I've converted windows style line ending to unix style line ending, and added
#!/usr/bin/env python2.7
to the head of my app.py, but the container failed to boot with exit code 127, showing

vote_1    |  * Serving Flask app "app" (lazy loading)\r
vote_1    |  * Environment: production
vote_1    |    WARNING: This is a development server. Do not use it in a production deployment.
vote_1    |    Use a production WSGI server instead.
vote_1    |  * Debug mode: on
vote_1    |  * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
vote_1    |  * Restarting with stat
': No such file or directoryte 'python2.7
examplevotingapp_vote_1 exited with code 127

any ideas?

@davidem
Copy link
Author

davidem commented Jun 24, 2019

': No such file or directoryte 'python2.7
...
any ideas?

Do you have python 2.7 installed? 😎
Never mind... stupid remark... see below

@wusatosi
Copy link

': No such file or directoryte 'python2.7
...
any ideas?

Do you have python 2.7 installed? 😎

do I need to install that on the host machine?

@davidem
Copy link
Author

davidem commented Jun 25, 2019

do I need to install that on the host machine?

No... strike my comment... I was stupid 🤭

Can you post the first few lines of app.py?

Another option: remove everything and start from scratch. Unless you've made significant changes.

@wusatosi
Copy link

do I need to install that on the host machine?

No... strike my comment... I was stupid 🤭

Can you post the first few lines of app.py?

Another option: remove everything and start from scratch. Unless you've made significant changes.

In the Docker Quickstart Terminal

$ cat vote/app.py
#!/usr/bin/env python2.7

from flask import Flask, render_template, request, make_response, g
from redis import Redis
import os
import socket
import random
import json

I think should add the shebang and make an pull request 😏

@davidem
Copy link
Author

davidem commented Jun 25, 2019

hmm... looks ok. Strange. And you're using the original Dockerfile to build 'vote'? I mean: it 's still using python:2.7-alpine?

@wusatosi
Copy link

hmm... looks ok. Strange. And you're using the original Dockerfile to build 'vote'? I mean: it 's still using python:2.7-alpine?

Yes... I did not change the Dockerfile, more strangly, if I compile and build it as an single image, it runs smoothly without any warning. even with the shebang removed, I think it is an docker-compose issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants