Search code examples
dockerdockerfilejython

NotImplementedError while installing jython in dockerfile


I have a Dockerfile building upon a 1.7.0_45 JAVA which I want to install jython inside it. This is how I implemented this according to this:

FROM java:7.0_45
MAINTAINER Zeinab Abbasimazar (zeinab.abbasi@peykasa.ir)
ENV JYTHON_VERSION=2.7.0
RUN apt-get update; \
    apt-get install -y --no-install-recommends apt-utils; \
    apt-get install -y curl; \
    curl -Lo jython-installer-$JYTHON_VERSION.jar \
    "http://search.maven.org/remotecontent?filepath=org/python/jython-installer/$JYTHON_VERSION/jython-installer-$JYTHON_VERSION.jar"; \
    java -jar jython-installer-$JYTHON_VERSION.jar -s -t minimum -i mod -i ensurepip -d /usr/local/jython-$JYTHON_VERSION; \
    rm -f jython-installer-$JYTHON_VERSION.jar; \
    ln -s /usr/local/jython-$JYTHON_VERSION/bin/* /usr/local/bin/
RUN java -version
ENTRYPOINT ["bash"]

The java:7.0_45 is downloaded from an internal repository.

The output of java -version is:

java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

During build phase, I got this:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100   161  100   161    0     0    195      0 --:--:-- --:--:-- --:--:--   195
100 88.5M  100 88.5M    0     0   113k      0  0:13:22  0:13:22 --:--:--  117k
Performing silent installation
 10 %
 20 %
 30 %
 40 %
 50 %
 60 %
Generating start scripts ...
Installing pip and setuptools
 90 %
Traceback (most recent call last):
  File "/usr/local/jython-2.7.0/Lib/runpy.py", line 161, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/jython-2.7.0/Lib/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/jython-2.7.0/Lib/ensurepip/__main__.py", line 4, in <module>
    ensurepip._main()
  File "/usr/local/jython-2.7.0/Lib/ensurepip/__init__.py", line 220, in _main
    bootstrap(
  File "/usr/local/jython-2.7.0/Lib/ensurepip/__init__.py", line 123, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/usr/local/jython-2.7.0/Lib/ensurepip/__init__.py", line 45, in _run_pip
    import pip
  File "/tmp/tmpt9RVvB/pip-1.6-py2.py3-none-any.whl/pip/__init__.py", line 10, in <module>
  File "/tmp/tmpt9RVvB/pip-1.6-py2.py3-none-any.whl/pip/util.py", line 17, in <module>
  File "/tmp/tmpt9RVvB/pip-1.6-py2.py3-none-any.whl/pip/locations.py", line 109, in <module>
  File "/tmp/tmpt9RVvB/pip-1.6-py2.py3-none-any.whl/pip/locations.py", line 71, in _get_build_prefix
  File "/tmp/tmpt9RVvB/pip-1.6-py2.py3-none-any.whl/pip/locations.py", line 66, in __get_username
  File "/usr/local/jython-2.7.0/Lib/pwd.py", line 60, in getpwuid
    return struct_passwd(entry)
  File "/usr/local/jython-2.7.0/Lib/pwd.py", line 36, in __new__
    pwd = (newStringOrUnicode(pwd.loginName), newStringOrUnicode(pwd.password), int(pwd.UID),
NotImplementedError: passwd.pw_passwd unimplemented
 100 %
Congratulations! You successfully installed Jython 2.7.0 to directory /usr/local/jython-2.7.0.

The jython works fine in run phase though, but I'm curios what causes this error. Any information that can help?

EDIT 1:

I should mention that I have no problem installing it on an ubuntu 16.04 system.


Solution

  • I have solved the issue by adding python in apt-get download list:

    apt-get install -y curl python2.7 python-dev
    

    Now, this is the output:

      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
    100   161  100   161    0     0     89      0  0:00:01  0:00:01 --:--:--    89
    100 88.5M  100 88.5M    0     0  99631      0  0:15:32  0:15:32 --:--:--  117k
    Performing silent installation
     10 %
     20 %
     30 %
     40 %
     50 %
     60 %
    Generating start scripts ...
    Installing pip and setuptools
     90 %
    Ignoring indexes: https://pypi.python.org/simple/
    Downloading/unpacking setuptools
    Downloading/unpacking pip
    Installing collected packages: setuptools, pip
    Successfully installed setuptools pip
    Cleaning up...
     100 %
    Congratulations! You successfully installed Jython 2.7.0 to directory /usr/local/jython-2.7.0.
     ---> 0672c44d1960