Created
September 20, 2018 10:54
-
-
Save renatomefi/1d87c6a7c41f881748053d6d2c56edd5 to your computer and use it in GitHub Desktop.
A mongo Dockerfile with SSL support out of the box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mongo:4.0 | |
# Works with Mongo 3.2 till 4.0 | |
WORKDIR /etc/ssl | |
# If you want to validate the certifacate you should have it somewhere else an copy here, otherwise you won't be able to | |
RUN set -xe \ | |
&& openssl req -newkey rsa:2048 -new -x509 -days 365 -nodes -out mongodb-cert.crt -keyout mongodb-cert.key -subj "/C=NL/ST=Noord Holland/L=Amsterdam/O=Me/OU=Somewhere/CN=mongo" \ | |
&& cat mongodb-cert.key mongodb-cert.crt > mongodb.pem | |
ENTRYPOINT ["mongod", "--sslMode", "requireSSL", "--sslPEMKeyFile", "/etc/ssl/mongodb.pem"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment