user584018
user584018

Reputation: 11364

how I can add the `Certificates` folder in local docker environment?

My docker containers works fine on Virtual Machine where I have related pfx certificate and configuration files reside in home folder /home/myVM/Certificates. In this folder I have pfx certificate file along with one JSON configuration.

My docker compose defines volumes like below,

 volumes:
    # Certificates folder should be present in the host VM with all certificates along with CertificateConfigurations.json
  - "./Certificates:/app/certs:ro"

Now when I am running docker container in local environment (my laptop) where I don't have Certificates folders like VM, it is searching for it.

Question, how I can add the Certificates folder in local docker environment?

Upvotes: 0

Views: 2152

Answers (1)

Ryan.Bartsch
Ryan.Bartsch

Reputation: 4210

You could just create the Certificates folder in your Dockerfile. If you're using a third party image you can just build on top of it e.g.

FROM xyz:123
RUN mkdir /path-to-certs/Certificates
COPY ./certs/cert.pfx /path-to-certs/Certificates

and then in you're docker compose file:

services:

   xyz:
      build:
         context: /relative-path-to-dockerfile
      ...

and run docker compose up --build

Alternatively you could exec into the container to add the Certificates folder, but you'd need to do this each time you run a new container instance...

Upvotes: 1

Related Questions