I have to add my own CA certificate inside a docker container.
When I try to run the command "dpkg-reconfigure ca-certificates" inside the Dockerfile it fails because cannot use the interactive interface.
How can I run interactively inside the dockerfile?
Or is it possible to tell "dpkg-reconfigure ca-certificates" to enable all certificates without asking?
This is the Dockerfile:
# Docker Image which is used as foundation to create
# a custom Docker Image with this Dockerfile
FROM node:15
ENV NODE_EXTRA_CA_CERTS=/usr/src/app/mrootca.pem
ENV TERM=xterm
# A directory within the virtualized Docker environment
# Becomes more relevant when using Docker Compose later
WORKDIR /usr/src/app
# install CA cetificare in the OS
COPY ./mrootca.pem /usr/share/ca-certificates/mrootca.crt
RUN dpkg-reconfigure ca-certificates
# Copies package.json and package-lock.json to Docker environment
COPY package*.json ./
COPY mrootca.pem ./
# Installs all node packages
RUN npm install
# Copies everything over to Docker environment
COPY . .
# Uses port which is used by the actual application
EXPOSE 3000
# Finally runs the application
CMD [ "npm", "start" ]
The docker image is generated with the command:
docker build --tag fpresenter:v1 .
0 Answers