简体   繁体   English

docker&docker-compose-Apache映像,具有在SSL证书,自签名,让我们加密或禁用之间进行切换的选项

[英]docker & docker-compose - Apache image with an option to switch between SSL Cert, self-signed, Let's Encryp or disabled

I'm creating a docker image for Apache. 我正在为Apache创建一个docker镜像。 I would like to configure SSL certs with an option to switch between different certificate provider. 我想配置SSL证书,并带有在不同证书提供者之间切换的选项。

SSL Cert (or) Let's Encryp (or) Self Signed (or) Disable SSL altogether SSL证书 (或) 让我们加密 (或) 自签名 (或) 完全禁用SSL

Any idea on how to accomplish that? 关于如何做到这一点的任何想法? Unfortunately cannot find any example out on the internet. 不幸的是,在互联网上找不到任何示例。 Any help is greatly appreciated. 任何帮助是极大的赞赏。 Thanks! 谢谢!

Dockerfile: Dockerfile:

FROM centos:centos7
RUN yum -y install epel-release && \
    yum -y update
RUN yum -y install httpd mod-ssl
RUN yum clean all && \
    rm -rf /var/cache/yum
...

I want to be able to do something like this. 我希望能够做这样的事情。

Docker run: Docker运行:

SSL Cert: SSL证书:

docker run -d -e sslCertType=sslCert 
              -v /etc/cert.crt:/etc/httpd/conf.d/cert.crt 
              -v /etc/intermediate.crt:/etc/httpd/conf.d/intermediate.crt
              -v /etc/passphrase.sh:/etc/httpd/conf.d/passphrase.sh 
                 apache

LetsEncrpt: LetsEncrpt:

docker run -d -e sslCertType=letsEncrypt apache

Self Signed: 自签名:

docker run -d -e sslCertType=selfSigned apache

disabled: 禁用:

docker run -d apache

Why don't you just build 4 different images with different configuration and tag them correctly ie 您为什么不只构建4个具有不同配置的不同图像并正确标记它们,即

apache:selfSigned 阿帕奇:自签名

apache:sslCert 阿帕奇:的sslcert

and then just run them accordingly ie: 然后相应地运行它们,即:

docker run -d apache:selfSigned

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM