Originally posted by @ajdruff at docker-library/wordpress#46 (comment)
-
expose port 443 by adding the following to your compose file:
ports: - "443:443"
-
restart your container (be sure your db and web files are on persistent storage!)
docker-compose down docker-compose up -d
-
attach to the running container
docker exec -t -i CONTAINER_ID /bin/bash
-
install ssl-cert ( automatically installs self-signed cert)
apt-get update && \ apt-get install -y --no-install-recommends ssl-cert && \ rm -r /var/lib/apt/lists/* && \ a2enmod ssl && \ a2ensite default-ssl
You may get a prompt about restarting apache before the new settings take effect.
service apache2 reload
-
exit the container (won't kill your container)
CTRL-P-Q
-
Access your https://example.com , adding an exception to your browser to ignore the prompt about untrusted CA