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

Python console entrypoint not working with docker slim #143

Open
etherai opened this issue Apr 13, 2020 · 1 comment
Open

Python console entrypoint not working with docker slim #143

etherai opened this issue Apr 13, 2020 · 1 comment

Comments

@etherai
Copy link

etherai commented Apr 13, 2020

I have a python module that registers a console entrypoint (see https://python-packaging.readthedocs.io/en/latest/command-line-scripts.html) via setuptools. The entrypoint of my container invokes this command (which in turns invokes itself several times). The resulting slim image contains the exeutable in my shell's path however it does not work. Attempting to run the command from the resulting slim images produces:

# notectl
Traceback (most recent call last):
  File "/usr/local/bin/notectl", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3254, in <module>
    def _initialize_master_working_set():
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3237, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 584, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'noteworthy==0.0.1' distribution was not found and is required by the application

Looking in /usr/local/lib/python3.8/sites-packages/ I can see that the package referenced in the error above is included in the resulting slim image. I

I'm not sure how to troubleshoot this. Any advice is much appreciated!

@kcq
Copy link
Member

kcq commented May 16, 2020

@etherai do you mind sharing the ENTRYPOINT/CMD instructions from your application image? What kind of python base image are you using? Is it Alpine-based? Can you share your docker-slim build command line parameters? Curious how you invoke it... Can you also enable debugging (using the global --debug flag) and the container console logs (using the --show-clogs build command flag)? Your build command should look like this (i assume your app is not a server): docker-slim --debug build --show-clogs --http-probe=false YOUR_TARGET_IMAGE

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

1 participant