1

I'm new to docker. The developers on my work create a docker-compose with mongodb and asp.net core application setup, although its funcional, they didin't setup SSL for the application, mongodb isn't configured with ssl either, and all login and password information are in clear text on the docker-compose file.

Can anyone share a sample docker-compose file for mongodb with ssl? Mine is giving me an error informing that the access to the certificate is denied: These are my docker-compose for mongodb:

services:
  mongodb:
    image: mongo:latest
    environment:
      - MONGODB_USERNAME:username
      - MONGODB_PASSWORD:password
      - MONGODB_DATABASE:database
    volumes:
      - /home/mongodbdata:/data/db
      - /home/mongodbcert/mongodb.pem:/data/ssl/mongodb.pem
      - /home/mongodbcert/mongodb-cert.crt:/data/ssl/mongodb-cert.crt
    ports:
      - "27017:27017"
    command:
        --sslMode=requireSSL
        --sslPEMKeyFile=/data/ssl/mongodb.pem
        --sslCAFile=/data/ssl/mongodb-cert.crt

When i run docker-compose up i receive the error: "E NETWORK [main] cannot read certificate file: /data/ssl/mongodb.pem error:0200100D:system library:fopen:Permission denied"

I also would appreciate some instructions on how secure sensitive data, taking then off docker-compose file. What is the best practices?

Thank you. LCR

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.