1

I would like to use the module "pymysql" with the official python container https://hub.docker.com/_/python The only way I found so far is to make my own container like this:

FROM python:3

RUN pip install --upgrade pip && \
    pip install --no-cache-dir pymysql

Is there a parameter I can use or add the module in another way?I don't want to rely on my own image.

Marc
  • 1,088
  • 8
  • 9
  • 3
    Is there a specific reason you don't want to rely on your own image? Docker images are all about composition, I would say your current solution is very natural. – Mario Ishac Aug 15 '20 at 08:48
  • Don't mean to be abrupt but the answer is no. – Vasili Syrakis Aug 15 '20 at 09:18
  • ok. I thought there may be a way set parameters in the python image for the modules that are missing. But that way the modules would be installed each time the container starts.I see that this is not possible. I also thought that this problem should be solved many times because mysql is not that exotic. Can somebody tell my why my question gets downvoted? – Marc Aug 15 '20 at 10:41

1 Answers1

0

Another way is to install the driver inside the docker image from the requirements.txt file:

PyMySQL<3.0
MySqlClient<3.0
... (whatever else your app requires) ...
Jorge Pirela
  • 129
  • 1
  • 6