Hi All,
I contact you because I have a problem trying to load two executable files using configmaps and run them. Before getting to this, until today I used a docker image where I uploaded the files via Dockerfile and ran them as per the following guide:
https://docs.docker.com/config/containers/multi-service_container/
Now I need to change this, and I have to upload the files as configmap. So I cleaned up my dockerfile so that it doesn’t copy anything when creating the image, I just copy the nginx config file and set the USER to nginx.
FROM registry.access.redhat.com/ubi8/ubi:8.6
USER root
RUN curl -sL https://rpm.nodesource.com/setup_18.x | bash -
RUN yum install -y openssl ca-certificates nginx wget procps net-tools nodejs gcc-c++ make
ADD ./nginx.conf /etc/nginx/nginx.conf
RUN chown -R nginx:nginx /var/log/nginx &&
chown -R nginx:nginx /etc/nginx
RUN touch /var/run/nginx.pid &&
chown -R nginx:nginx /var/run/nginx.pid
USER nginx
EXPOSE 8080 8443 9090
#CMD nginx -g “daemon off;”
#CMD node /opt/nodejs/server.js
#CMD /etc/nodejs/startScript.sh
Then I have 3 .sh files that I insert in a configmap and that I will find in the assigned mountpath. One of the 3 files (the MASTER) starts the other 2 (one is nginx as commented above and the other is a nodejs server start), and as I found in this guide:
https://etoews.github.io/blog/2017/07/29/inject-an-executable-script-into-a-container-in-kubernetes/
I set the “defaultmode” of the configmap to 0744 and the command in spec: so that it starts the MASTER executable file. Despite this, I get the “permission denied” error when the script tries to run the other two.
What is the best way to overcome this problem?
Thank you