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

Cannot run docker-compose - python not found #16

Closed
krim404 opened this issue Apr 19, 2020 · 32 comments
Closed

Cannot run docker-compose - python not found #16

krim404 opened this issue Apr 19, 2020 · 32 comments
Labels

Comments

@krim404
Copy link

krim404 commented Apr 19, 2020

i cannot start the bbb-exporter docker container.

Status: Downloaded newer image for greenstatic/bigbluebutton-exporter:v0.2.0
Creating bbb-exporter ... error

ERROR: for bbb-exporter Cannot start service bbb-exporter: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: "python": executable file not found in $PATH": unknown

@greenstatic
Copy link
Owner

I think this is a docker-compose issue. You are probably running this on Ubuntu 18.04 LTS or similar since afaik they do not sym link python to python2 or python3. You can confirm this by running python --version in the shell. If you get a command not found or similar error this confirms my suspicion.

The best course of action to take is to manually create a symbolic link python -> python3:

sudo ln -s /usr/bin/python3 /usr/bin/python

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

python is installed. as far as i can see this error is from within the docker instance. didnt the python upstream change the default command from python to python3 in a recent version?

root@bbb:~/bbb-exporter# python --version
Python 2.7.12

@greenstatic
Copy link
Owner

The container image should be okay, since you are the first to report this issue.

Can you confirm you can run the following:

docker run --rm python:3.7-stretch python --version

This is the what the container uses: https://github.com/greenstatic/bigbluebutton-exporter/blob/master/Dockerfile#L1

If it works, then the container should work as well. Try creating the bbb-exporter container manually instead of using docker compose;

docker run --rm greenstatic/bigbluebutton-exporter:v0.2.0 

You should get a KeyError: 'API_BASE_URL' since we didn't supply any environment variables not a:

"exec: "python": executable file not found in $PATH": unknown

If you get a KeyError then the container works and you have a docker-compose issue.

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

the python command works, but sadly the docker run bbbexporter does not, same error:

root@bbb:~/bbb-exporter# docker run --rm greenstatic/bigbluebutton-exporter:v0.2.0
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: "python": executable file not found in $PATH": unknown.

all other docker-compose and docker run commands work (including greenlight)

@greenstatic
Copy link
Owner

This is very strange.
Try the following command:

docker run --rm --entrypoint python3 greenstatic/bigbluebutton-exporter:v0.2.0 

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

same error :-/

@greenstatic
Copy link
Owner

Can you also run

docker image ls

And paste both lines for python and greenstatic/bigbluebutton-exporter.

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

root@bbb:~# docker image ls
REPOSITORY                           TAG                 IMAGE ID            CREATED             SIZE
postgres                             9.5                 92c35e11d59c        2 days ago          197MB
python                               3.7-stretch         adfad110435a        2 days ago          941MB
bigbluebutton/greenlight             v2                  4b4075d493cc        2 weeks ago         198MB
greenstatic/bigbluebutton-exporter   latest              fc3c4ce90c0b        2 weeks ago         950MB
greenstatic/bigbluebutton-exporter   v0.2.0              84fdfb2f6e1a        2 weeks ago         950MB

@greenstatic
Copy link
Owner

We are running the exact same python and bbb-exporter docker images. This must be a docker host issue.

Can you specify the following:

  1. Which OS you are running and the version
  2. Docker version

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

root@bbb:~# docker --version
Docker version 19.03.8, build afacb8b7f0

Ubuntu 16.04.6 LTS (GNU/Linux 4.19.0-8-amd64 x86_64)

@greenstatic
Copy link
Owner

We are running the exact same Docker version on the same version on Ubuntu. Here is one of our bbb servers:

ubuntu@bbb2:~$ docker --version
Docker version 19.03.8, build afacb8b7f0
ubuntu@bbb2:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.6 LTS
Release:	16.04
Codename:	xenial
ubuntu@bbb2:~$ sudo docker image ls
REPOSITORY                             TAG                   IMAGE ID            CREATED             SIZE
greenstatic/bigbluebutton-exporter     v0.2.0                84fdfb2f6e1a        2 weeks ago         950MB
bigbluebutton/greenlight               v2                    2adae0c5cc94        6 weeks ago         198MB
postgres                               9.5                   222fd382d72b        6 weeks ago         197MB
ubuntu@bbb2:~$ sudo docker run --rm greenstatic/bigbluebutton-exporter:v0.2.0 
Traceback (most recent call last):
  File "server.py", line 6, in <module>
    import settings
  File "/app/settings.py", line 14, in <module>
    API_BASE_URL = validate_api_base_url(os.environ["API_BASE_URL"])
  File "/usr/local/lib/python3.7/os.py", line 681, in __getitem__
    raise KeyError(key) from None
KeyError: 'API_BASE_URL'

This is definitely some weird host thing.
Can you post the output of:

ls -l $(which python)
python3 --version

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

root@bbb:~/greenlight# ls -l $(which python)
lrwxrwxrwx 1 root root 16 Apr 19 17:19 /usr/bin/python -> /usr/bin/python3
root@bbb:~/greenlight# python3 --version
Python 3.5.2

(changed the default python library a few minutes ago from 2.7 to 3)

@greenstatic
Copy link
Owner

You better change it back to 2.7 if it was present. Too many system scripts rely on that. In case it wasn't set it wouldn't be such big of an issue to change it.

Did you try any of the previous commands with python->python3 ? If so, retry them.

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

i did all of them with python2.7 and 3 on two different machines set up at the exact same time of the day. Everything is the same. :/

root@bbb:~# ls -l $(which python)
lrwxrwxrwx 1 root root 9 Nov 24  2017 /usr/bin/python -> python2.7
root@bbb:~# python3 --version
Python 3.5.2
root@bbb:~# docker run --rm greenstatic/bigbluebutton-exporter:v0.2.0 
Unable to find image 'greenstatic/bigbluebutton-exporter:v0.2.0' locally
v0.2.0: Pulling from greenstatic/bigbluebutton-exporter
56da78ce36e9: Pull complete 
fbfe0f13ac45: Pull complete 
6254ff6d0e60: Pull complete 
e0e1e13bd9f6: Pull complete 
b86b38b40a24: Pull complete 
95c084d1b13d: Pull complete 
64ae447470c7: Pull complete 
76c1316cdff4: Pull complete 
be6eeb547f33: Pull complete 
7e610c2cacf8: Pull complete 
647bc4934405: Pull complete 
ddcb06e8a5ff: Pull complete 
Digest: sha256:a71b9b6dcd858ad6772fb4ff98e5946a487a0da760a4eafc8d62ec888d3e5e64
Status: Downloaded newer image for greenstatic/bigbluebutton-exporter:v0.2.0
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"python\": executable file not found in $PATH": unknown.

@greenstatic
Copy link
Owner

Did you change anything on the system? I see this is your bbb (and previously bbb2) host. If you tried on a different system with e.g. Ubuntu 18.04 this shouldnt occur. I'm trying on my mac and on our bbb server and I can't replicate your issue.

How did you install docker?

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

i didnt change anything on the system, it is a clean ubuntu 16.04 minimal inside a vm and setup using the bbb-install script.

@greenstatic
Copy link
Owner

It's a shot in the dark, but could you try the docker command with the ubuntu user and not root? You will need to run with sudo.

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

ubuntu@bbb:/root/greenlight$ sudo docker run --rm greenstatic/bigbluebutton-exporter:v0.2.0 
[sudo] password for ubuntu: 
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"python\": executable file not found in $PATH": unknown.
ERRO[0005] error waiting for container: context canceled 

@greenstatic
Copy link
Owner

docker run --rm --entrypoint /usr/local/bin/python3 greenstatic/bigbluebutton-exporter:v0.2.0 server.py

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

ubuntu@bbb:~$ sudo docker run --rm --entrypoint /usr/local/bin/python3 greenstatic/bigbluebutton-exporter:v0.2.0 server.py
[sudo] password for ubuntu: 
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"/usr/local/bin/python3\": stat /usr/local/bin/python3: permission denied": unknown.

@greenstatic
Copy link
Owner

Okay now we are getting a permission error, this is getting stranger the deeper we go.

Override the user of the container to root;

 sudo docker run --rm --user 0 --entrypoint /usr/local/bin/python3 greenstatic/bigbluebutton-exporter:v0.2.0 server.py

@greenstatic
Copy link
Owner

Do you have selinux/apparmor or anything similar enabled?

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

yes, apparmor is enabled. Overwriting user works!

ubuntu@bbb:~$  sudo docker run --rm --user 0 --entrypoint /usr/local/bin/python3 greenstatic/bigbluebutton-exporter:v0.2.0 server.py
Traceback (most recent call last):
  File "server.py", line 6, in <module>
    import settings
  File "/app/settings.py", line 14, in <module>
    API_BASE_URL = validate_api_base_url(os.environ["API_BASE_URL"])
  File "/usr/local/lib/python3.7/os.py", line 681, in __getitem__
    raise KeyError(key) from None
KeyError: 'API_BASE_URL'

@greenstatic
Copy link
Owner

Did you change your apparmor config besides the defaults?

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

nope, i'm just starting to set up the servers, it is not modified, yet.
so may i suggest to remove the user nobody directive from the dockerfile?

@greenstatic
Copy link
Owner

I'll ask around a bit to see what other docker specialist think about this issue in the mean time I suggest you override the user (try first without entrypoint) in the docker-compose file.

The user nobody is standard best practice in the dockerfile so the process doesn't run as root in the container - a security precaution.

@krim404
Copy link
Author

krim404 commented Apr 19, 2020

ok, i changed the docker-compose and now it is working (as a temporary workaround)

  bbb-exporter:
    container_name: "bbb-exporter"
    user: "root"
    image: greenstatic/bigbluebutton-exporter:${BBB_EXPORTER_VERSION:-latest}
    ports:
      - "127.0.0.1:9688:9688"
    env_file:
      - secrets.env

@greenstatic
Copy link
Owner

If you find anything regarding this, do share 😄 I'm completely stumped what the issue is 🤔

@greenstatic
Copy link
Owner

Did you by any chance solve the original issue?

@krim404
Copy link
Author

krim404 commented Sep 15, 2020

no, i didnt have any time to debug the initial issue and continued using the workaround

@greenstatic
Copy link
Owner

Did you manage to solve your issue?
I'll be closing this issue for now, feel free to reopen in case the issue is not solved.

@krim404
Copy link
Author

krim404 commented Jun 2, 2022

its still the same

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

No branches or pull requests

2 participants