Docker Community Forums

Share and learn in the Docker community.

How do I install an SSL certificate in apache2 on Docker for Windows


(Seandevoy) #1

HI,

I have a docker config with PHP and MARIADB working great on Windows and deployed on Digital Ocean droplet. I have mapped the and MariaDB files to the file system for permanence during reboots, etc.

Everything works in both environments.

Unfortunately, I do not know how to install an SSL in APACHE at all, much less in DOCKER. I have the GoDaddy .pfx file. I have split out the the key and the crt into .PEM files.

I have read many posts for docker and not and I don’t know what I am doing wrong.

Here is my BUILD file:

FROM php:7.0-apache
RUN apt-get update && apt-get install -y
libfreetype6-dev
libjpeg62-turbo-dev
libmcrypt-dev
libpng-dev
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
&& docker-php-ext-install pdo pdo_mysql gd zip
&& docker-php-ext-install mysqli
&& docker-php-ext-enable mysqli

and here is my yml file:

web:

image: seandevoy/php7.0-for-c5-8:2.0
restart: always

environment:

  - ALLOW_OVERRIDE=true

ports:

 - "80:80"

links:

 - db

container_name: php-fpm
volumes:

 - ./app:/var/www/html

db:
image: mariadb:10.0.33
restart: always
ports:
- “3306:3306”
container_name: mariadb
environment:

  • MYSQL_ROOT_PASSWORD=REDACTED
  • MYSQL_USER=REDACTED
  • MYSQL_PASSWORD=REDACTED
  • MYSQL_DATABASE=REDACTED
    volumes:
  • ./data/mysql:/var/lib/mysql
  • ./data/config:/etc/mysql/conf.d

Can anyone guide me through this?
Also, we would like to force/redirect to https:/ when it is installed too.

Thanks,
Sean