0
votes

I have successfully installed ibm_db v3.0.1 package in docker image but when i am trying to import ibm_db_dbi module it throw the error.

Dockerfile :

FROM python:3.6.8-alpine3.9

WORKDIR /run

COPY . /run

RUN pip install --trusted-host pypi.python.org -r requirements.txt

EXPOSE 7000

CMD ["python", "run.py"]

after build its successfully executed the below ibm_db module to image.

Downloading https://files.pythonhosted.org/packages/98/cb/f77d9bd5f64246074af364cc30e20e3044c533890f3b67d30e89615c2fc5/ibm_db-3.0.1.tar.gz (642kB)

Please help me resolve this issue.

command to run docker image :-  docker run -it -p 7000:7000  dotsapi

error while running the docker file:-

File "/run/Informix_Conn.py", line 3, in

import ibm_db_dbi as db ImportError: Error loading shared library libcrypt.so.1: No such file or directory (needed by

/usr/local/lib/python3.6/site-packages/clidriver/lib/libdb2.so.1)

Thanks in advance!!

1
Can you edit your question to add the actual text of the Dockerfile you're running and the specific error message you're getting? If it's an error while running the container, also a minimal excerpt from the Python script and the docker run command? - David Maze

1 Answers

0
votes

You can add a pip install ibm_db in your dockerfile or create a requirements.txt file. And call him in your dockerfile with :

 ADD        ./requirements.txt ./
 RUN        python3 -m pip install -r requirements.txt

EDIT It worked for me : In my dockerfile :

FROM       python:3.6
ADD        ./requirements.txt ./
RUN        python3 -m pip install -r requirements.txt
ADD        ./test.py /run

After building succesfully I ran my image with

docker run --name testpython testpython:1 sleep 3600

Go in my container

docker exec -it testpython /bin/bash

And when I run a python console or my test script, the import is OK.

NOTE : With the image python:3.6.8-alpine3.9 the build doesn't work. Check this to see why