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?
Try splitting the whole command:
["python3", "-m", "pip", "install", "moduleexample"]
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.