Answer the question
In order to leave comments, you need to log in
How to provide host files to containers?
There are certificates in the folder on the host, they must be transferred to almost all containers. I add volume to docker-compose:
backend:
container_name: backend
build: ./backend
volumes:
- ./devCerts:/app/certs
ports:
- 3333:3333
ARG CERTSDIR=/app/certs
ARG ROOTCERT=mkcert_root.pem
ARG LINCERT=/usr/local/share/ca-certificates
RUN cp $CERTSDIR/$ROOTCERT $LINCERT/$ROOTCERT
RUN chmod 644 $LINCERT/$ROOTCERT && update-ca-certificates
cannot stat '/app/certs/mkcert_root.pem': No such file or directory
ADD ./../devCerts /app/certs
?
Answer the question
In order to leave comments, you need to log in
You don't quite understand what's going on. First, the backend container is built and only then it is launched with the volumes parameter, which will attach the directory inside the container. Those. you either have to really do ADD in the dockerfile, which is not very convenient. Or specify the attachment directly
volumes:
- ./devCerts/mkcert_root.pem:/usr/local/share/ca-certificates/mkcert_root.pem
volumes:
- ./devCerts:/usr/local/share/ca-certificates
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question