I need to install some python packages in docker image and deploy that image as kubernetes deployment. Below are my Dockerfile and deployment file
FROM python:3.7-slim
# install FreeTDS and dependencies
RUN apt-get update \
&& apt-get install unixodbc -y \
&& apt-get install unixodbc-dev -y \
&& apt-get install freetds-dev -y \
&& apt-get install freetds-bin -y \
&& apt-get install tdsodbc -y \
&& apt-get install --reinstall build-essential -y
# populate "ocbcinst.ini"
RUN echo "[FreeTDS]\n\
Description = FreeTDS unixODBC Driver\n\
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so\n\
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so" >> /etc/odbcinst.ini
# install pyodbc (and, optionally, sqlalchemy)
RUN pip install --trusted-host pypi.python.org pyodbc==4.0.26 sqlalchemy==1.3.5 pyarrow
# run app.py upon container launch
CMD ["python3"]
docker image build command
docker build pyarrow-custom:latest .
apiVersion: apps/v1
kind: Deployment
metadata:
name: python-odbc-custom
labels:
app: python-odbc-custom
spec:
replicas: 1
selector:
matchLabels:
app: python-odbc-custom
template:
metadata:
name: python-odbc-custom
labels:
app: python-odbc-custom
spec:
containers:
- name: python-odbc-custom
image: "pyarrow-custom:latest"
command: ['python3']
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8099
kubectl command
kubectl apply -f python-obbc-deployment.yaml
However, After creating container it is getting completed. As I am giving python3 in CMD I want to keep running python shell there. How can i do that?