I need to run a pip install command in an initcontainer. I´m using the python:3.9-slim-buster image.
I created the following code, however I get the following error:
/usr/local/bin/python3: No module named pip install moduleexample
Code:
spec:
volumes:
- name: agent-volume
emptyDir: {}
initContainers:
- name: dd-apm-init
image: python:3.9-slim-buster
command: ["python3", "-m", "pip install moduleexample"]
resources: {}
volumeMounts:
- name: agent-volume
mountPath: /usr/local/lib/python3.9/site-packages
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
Any suggestions?
CodePudding user response:
Try splitting the whole command:
["python3", "-m", "pip", "install", "moduleexample"]
CodePudding user response:
You have given the command in the wrong format. It should be something like this -
spec:
volumes:
- name: agent-volume
emptyDir: {}
initContainers:
- name: dd-apm-init
image: python:3.9-slim-buster
command: ["python3", "-m", "pip", "install", "moduleexample"]
resources: {}
volumeMounts:
- name: agent-volume
mountPath: /usr/local/lib/python3.9/site-packages
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
Hope this would resolve the issue for you!
