...
The sidecar container is an extra container that you add to the ECD. To use the sidecar container, you must create your own Docker image and include the pythond.py
script in your image. This script can be found in $MZ_HOME${mz.home}/python
directory on the platform container.
...
Code Block |
---|
FROM python:3.12 RUN pip install pandas COPY pythond.py . CMD ["python", "pythond.py", "5454"] |
In this example, we are using the python:3.12
base image is used and installing the pandas
package is installed with pip
. We then copy the The pythond.py
script is then copied to the container and set the command set to run the script with port 5454
.
...
To add the container to your ECD, you can use a YAML snippet like this as shown below to apply your changes:
Code Block | ||
---|---|---|
| ||
spec: sidecars: - image: my-python-image:latest imagePullPolicy: IfNotPresent name: python-container |
This YAML example specifies that we want to add a sidecar container named python-container
with image my-python-image:latest
and imagePullPolicy
set to IfNotPresent
.
Please note Note that you can choose any port number instead of 5454
as long as it is not already in use by another process.
If you want to use your sidecar container for code completion in the Python Code Editors Editor as described in the Python Manager tool documentation(3.3), you also need to add your sidecar to the Platform. You can add a YAML snippet like this as shown below to your values.yaml to achieve this:
...