Base Image :
docker pull httpd
Dockerfile :
FROM httpd:latest
RUN apt-get update
RUN apt-get install -y iputils-ping traceroute coreutils net-tools vim nano curl iproute2 openssh-server openssh-client sshpass netcat-openbsd default-mysql-client
# Activate HTTPS:
# Modify : `/usr/local/apache2/conf/httpd.conf` in httpd's image
RUN sed -i \
-e 's/^#\(Include .*httpd-ssl.conf\)/\1/' \
-e 's/^#\(LoadModule .*mod_ssl.so\)/\1/' \
-e 's/^#\(LoadModule .*mod_socache_shmcb.so\)/\1/' \
conf/httpd.conf
# Copy certificate's files into image , you can uncomment the following lines :
COPY certs/server.crt /usr/local/apache2/conf/server.crt
COPY certs/server.key /usr/local/apache2/conf/server.key
## OR: copy the certificate's files in `docker run command`
# sudo docker run -dit --name httpds1 -p 443:443 -v "$PWD"/certs/server.crt:/usr/local/apache2/conf/server.crt -v "$PWD"/certs/server.key:/usr/local/apache2/conf/server.key --hostname httpds1 saz021/httpds:v2
docker build -t saz021/httpds:v1 .
.
├── certs
│ ├── server.crt
│ └── server.key
├── Dockerfile
1- Create a folder any copy certificate's file inner, this folder will be mounted into the container as volume:
-> Exemple for Letsencrypt, files to use :
[cert name]/privkey.pem rename to : server.crt & [cert name]/fullchain.pem rename to : server.key
Copy these files "server.crt" & "server.key" in a directory into volume used as volume:
2- Run the following commande
sudo docker run -dit --name httpds -p 443:443 -v "$PWD"/certs/server.crt:/usr/local/apache2/conf/server.crt -v "$PWD"/certs/server.key:/usr/local/apache2/conf/server.key --hostname httpds saz021/httpds:v2
Content type
Image
Digest
sha256:6c5230be7…
Size
129.5 MB
Last updated
over 2 years ago
docker pull saz021/httpds:v1