Я пытаюсь создать образ Docker с некоторыми python пакетами, которые мне нужны.
Вот Dockerfile, который я использую:
FROM oraclelinux:7.8
COPY ./fetch_session_iptv.py /opt/
COPY ./conf/fetch_session_iptv.conf /opt/conf/
#COPY ./conf/certs/* /opt/conf/certs/
COPY ./logs /opt/logs
RUN yum install -y \
https://yum.oracle.com/repo/OracleLinux/OL7/developer/x86_64/getPackage/oracle-instantclient18.3-basic-18.3.0.0.0-2.x86_64.rpm \
https://yum.oracle.com/repo/OracleLinux/OL7/developer/x86_64/getPackage/python36-cx_Oracle-7.0-1.0.2.el7.x86_64.rpm \
https://yum.oracle.com/repo/OracleLinux/OL7/developer/x86_64/getPackage/python36-pytz-2016.10-2.0.1.el7.noarch.rpm
COPY ./python_requirements/elasticsearch-7.8.0-py2.py3-none-any.whl .
COPY ./python_requirements/certifi-2020.4.5.2-py2.py3-none-any.whl .
COPY ./python_requirements/urllib3-1.25.9-py2.py3-none-any.whl .
COPY ./python_requirements/pytz-2019.3-py2.py3-none-any.whl .
RUN pip3 install \
certifi-2020.4.5.2-py2.py3-none-any.whl \
urllib3-1.25.9-py2.py3-none-any.whl \
elasticsearch-7.8.0-py2.py3-none-any.whl \
pytz-2019.3-py2.py3-none-any.whl
#CMD ["/bin/bash"]
CMD [ "python", "/opt/fetch_session_iptv.py" ]
Кажется, устанавливаются все зависимости в сборке:
Step 1/11 : FROM oraclelinux:7.8
7.8: Pulling from library/oraclelinux
50ab38810635: Pull complete
Digest: sha256:8d64add00f3b006bf2aae76e26100a334de153b43421671b52389c89e2bf0ba4
Status: Downloaded newer image for oraclelinux:7.8
---> d788eca028a0
Step 2/11 : COPY ./fetch_session_iptv.py /opt/
---> 52301bdc1114
Step 3/11 : COPY ./conf/fetch_session_iptv.conf /opt/conf/
---> d001bf5959fe
Step 4/11 : COPY ./logs /opt/logs
---> c4806eb7cfff
Step 5/11 : RUN yum install -y https://yum.oracle.com/repo/OracleLinux/OL7/developer/x86_64/getPackage/oracle-instantclient18.3-basic-18.3.0.0.0-2.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/developer/x86_64/getPackage/python36-cx_Oracle-7.0-1.0.2.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/developer/x86_64/getPackage/python36-pytz-2016.10-2.0.1.el7.noarch.rpm
---> Running in 3dd09805d581
Loaded plugins: ovl, ulninfo
Examining /var/tmp/yum-root-iRz8qd/oracle-instantclient18.3-basic-18.3.0.0.0-2.x86_64.rpm: oracle-instantclient18.3-basic-18.3.0.0.0-2.x86_64
Marking /var/tmp/yum-root-iRz8qd/oracle-instantclient18.3-basic-18.3.0.0.0-2.x86_64.rpm to be installed
Examining /var/tmp/yum-root-iRz8qd/python36-cx_Oracle-7.0-1.0.2.el7.x86_64.rpm: python36-cx_Oracle-7.0-1.0.2.el7.x86_64
Marking /var/tmp/yum-root-iRz8qd/python36-cx_Oracle-7.0-1.0.2.el7.x86_64.rpm to be installed
Examining /var/tmp/yum-root-iRz8qd/python36-pytz-2016.10-2.0.1.el7.noarch.rpm: python36-pytz-2016.10-2.0.1.el7.noarch
Marking /var/tmp/yum-root-iRz8qd/python36-pytz-2016.10-2.0.1.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-instantclient18.3-basic.x86_64 0:18.3.0.0.0-2 will be installed
--> Processing Dependency: libaio for package: oracle-instantclient18.3-basic-18.3.0.0.0-2.x86_64
---> Package python36-cx_Oracle.x86_64 0:7.0-1.0.2.el7 will be installed
--> Processing Dependency: python(abi) = 3.6 for package: python36-cx_Oracle-7.0-1.0.2.el7.x86_64
--> Processing Dependency: libpython3.6m.so.1.0()(64bit) for package: python36-cx_Oracle-7.0-1.0.2.el7.x86_64
---> Package python36-pytz.noarch 0:2016.10-2.0.1.el7 will be installed
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package python3.x86_64 0:3.6.8-13.0.1.el7 will be installed
--> Processing Dependency: python3-pip for package: python3-3.6.8-13.0.1.el7.x86_64
--> Processing Dependency: python3-setuptools for package: python3-3.6.8-13.0.1.el7.x86_64
---> Package python3-libs.x86_64 0:3.6.8-13.0.1.el7 will be installed
--> Processing Dependency: libtirpc.so.1()(64bit) for package: python3-libs-3.6.8-13.0.1.el7.x86_64
--> Running transaction check
---> Package libtirpc.x86_64 0:0.2.4-0.16.el7 will be installed
---> Package python3-pip.noarch 0:9.0.3-7.el7_8 will be installed
---> Package python3-setuptools.noarch 0:39.2.0-10.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
oracle-instantclient18.3-basic x86_64 18.3.0.0.0-2 /oracle-instantclient18.3-basic-18.3.0.0.0-2.x86_64
220 M
python36-cx_Oracle x86_64 7.0-1.0.2.el7 /python36-cx_Oracle-7.0-1.0.2.el7.x86_64
1.3 M
python36-pytz noarch 2016.10-2.0.1.el7 /python36-pytz-2016.10-2.0.1.el7.noarch
919 k
Installing for dependencies:
libaio x86_64 0.3.109-13.el7 ol7_latest 24 k
libtirpc x86_64 0.2.4-0.16.el7 ol7_latest 89 k
python3 x86_64 3.6.8-13.0.1.el7 ol7_latest 69 k
python3-libs x86_64 3.6.8-13.0.1.el7 ol7_latest 7.0 M
python3-pip noarch 9.0.3-7.el7_8 ol7_latest 1.8 M
python3-setuptools noarch 39.2.0-10.el7 ol7_latest 628 k
Transaction Summary
================================================================================
Install 3 Packages (+6 Dependent packages)
Total size: 232 M
Total download size: 9.5 M
Installed size: 270 M
Downloading packages:
--------------------------------------------------------------------------------
Total 1.4 MB/s | 9.5 MB 00:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libaio-0.3.109-13.el7.x86_64 1/9
Installing : oracle-instantclient18.3-basic-18.3.0.0.0-2.x86_64 2/9
Installing : libtirpc-0.2.4-0.16.el7.x86_64 3/9
Installing : python3-libs-3.6.8-13.0.1.el7.x86_64 4/9
Installing : python3-setuptools-39.2.0-10.el7.noarch 5/9
Installing : python3-pip-9.0.3-7.el7_8.noarch 6/9
Installing : python3-3.6.8-13.0.1.el7.x86_64 7/9
Installing : python36-cx_Oracle-7.0-1.0.2.el7.x86_64 8/9
Installing : python36-pytz-2016.10-2.0.1.el7.noarch 9/9
Verifying : python3-3.6.8-13.0.1.el7.x86_64 1/9
Verifying : libtirpc-0.2.4-0.16.el7.x86_64 2/9
Verifying : python36-cx_Oracle-7.0-1.0.2.el7.x86_64 3/9
Verifying : python3-libs-3.6.8-13.0.1.el7.x86_64 4/9
Verifying : oracle-instantclient18.3-basic-18.3.0.0.0-2.x86_64 5/9
Verifying : python3-setuptools-39.2.0-10.el7.noarch 6/9
Verifying : libaio-0.3.109-13.el7.x86_64 7/9
Verifying : python36-pytz-2016.10-2.0.1.el7.noarch 8/9
Verifying : python3-pip-9.0.3-7.el7_8.noarch 9/9
Installed:
oracle-instantclient18.3-basic.x86_64 0:18.3.0.0.0-2
python36-cx_Oracle.x86_64 0:7.0-1.0.2.el7
python36-pytz.noarch 0:2016.10-2.0.1.el7
Dependency Installed:
libaio.x86_64 0:0.3.109-13.el7 libtirpc.x86_64 0:0.2.4-0.16.el7
python3.x86_64 0:3.6.8-13.0.1.el7 python3-libs.x86_64 0:3.6.8-13.0.1.el7
python3-pip.noarch 0:9.0.3-7.el7_8 python3-setuptools.noarch 0:39.2.0-10.el7
Complete!
Removing intermediate container 3dd09805d581
---> c71c9b3eafd9
Step 6/11 : COPY ./python_requirements/elasticsearch-7.8.0-py2.py3-none-any.whl .
---> e817f2eea76a
Step 7/11 : COPY ./python_requirements/certifi-2020.4.5.2-py2.py3-none-any.whl .
---> 5271764a4e78
Step 8/11 : COPY ./python_requirements/urllib3-1.25.9-py2.py3-none-any.whl .
---> 903b4e977f97
Step 9/11 : COPY ./python_requirements/pytz-2019.3-py2.py3-none-any.whl .
---> 9fe163a90794
Step 10/11 : RUN pip3 install certifi-2020.4.5.2-py2.py3-none-any.whl urllib3-1.25.9-py2.py3-none-any.whl elasticsearch-7.8.0-py2.py3-none-any.whl pytz-2019.3-py2.py3-none-any.whl
---> Running in f5fa17eedd5c
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Processing /certifi-2020.4.5.2-py2.py3-none-any.whl
Processing /urllib3-1.25.9-py2.py3-none-any.whl
Processing /elasticsearch-7.8.0-py2.py3-none-any.whl
Processing /pytz-2019.3-py2.py3-none-any.whl
Installing collected packages: certifi, urllib3, elasticsearch, pytz
Successfully installed certifi-2020.4.5.2 elasticsearch-7.8.0 pytz-2019.3 urllib3-1.25.9
Removing intermediate container f5fa17eedd5c
---> acf68ab49e26
Step 11/11 : CMD [ "python", "/opt/fetch_session_iptv.py" ]
---> Running in 94cd8c49a1a5
Removing intermediate container 94cd8c49a1a5
---> bcb331fc7575
Successfully built bcb331fc7575
Successfully tagged kansas-fetch:1.4-SNAPSHOT
Но затем, когда я пытаюсь запустить изображение docker Я получаю следующее сообщение об ошибке:
Traceback (most recent call last):
File "/opt/fetch_session_iptv.py", line 8, in <module>
import pytz
ImportError: No module named pytz
Я новичок в Docker, так что, наверное, я что-то делаю не так, но не могу найти, что именно.