classification
Title: Running inside docker container from non-root user
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Python startup should not require passwd entry
View: 10496
Assigned To: Nosy List: cinerar, r.david.murray
Priority: normal Keywords:

Created on 2017-09-14 15:12 by cinerar, last changed 2017-09-14 15:34 by r.david.murray. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3403 cinerar, 2017-09-14 15:12
Messages (2)
msg302172 - (view) Author: Dmitriy (cinerar) * Date: 2017-09-14 15:12
When i try to run youtube-dl inside docker container from non root user i recieve this error:

failed to import the site module traceback (most recent call last): file "/usr/lib/python3.6/site.py", line 544, in main() file "/usr/lib/python3.6/site.py", line 530, in main known_paths = addusersitepackages(known_paths) file "/usr/lib/python3.6/site.py", line 282, in addusersitepackages user_site = getusersitepackages() file "/usr/lib/python3.6/site.py", line 258, in getusersitepackages user_base = getuserbase() # this will also set user_base file "/usr/lib/python3.6/site.py", line 248, in getuserbase user_base = get_config_var('userbase') file "/usr/lib/python3.6/sysconfig.py", line 601, in get_config_var return get_config_vars().get(name) file "/usr/lib/python3.6/sysconfig.py", line 558, in get_config_vars _config_vars['userbase'] = _getuserbase() file "/usr/lib/python3.6/sysconfig.py", line 205, in _getuserbase return joinuser("~", ".local") file "/usr/lib/python3.6/sysconfig.py", line 184, in joinuser return os.path.expanduser(os.path.join(*args)) file "/usr/lib/python3.6/posixpath.py", line 247, in expanduser userhome = pwd.getpwuid(os.getuid()).pw_dir keyerror: 'getpwuid(): uid not found: 1000'

I believe this problem is described here:
http://blog.dscpl.com.au/2015/12/unknown-user-when-running-docker.html

this simple fix make it work again
msg302174 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-09-14 15:33
It sounds like docker is just broken (I would expect unix tools to work in a docker container).  That however is beside the point.

I believe this is a duplicate of issue 10496, but I don't know why it hasn't been fixed.
History
Date User Action Args
2017-09-14 15:34:28r.david.murraysetsuperseder: Python startup should not require passwd entry
2017-09-14 15:33:48r.david.murraysetstatus: open -> closed

type: behavior

nosy: + r.david.murray
messages: + msg302174
resolution: duplicate
stage: resolved
2017-09-14 15:12:08cinerarcreate