Public Repository

Last pushed: a month ago
Short Description
Apache HTTP server image
Full Description

Supported tags and respective Dockerfile links

  • latest, stable, 2, 2.4, 2.4.26, 2.4.26-r0 (Dockerfile)

Apache HTTP Server

This is an image for running your own [Apache HTTP Server]


  • Install Docker Compose on the system.
  • Review the documentation for Apache HTTP Server for details on how to configure and use the product.
  • Choose a location on the system in which to store Apache HTTP configuration settings and data.

Container Setup

Follow the steps below to set up the container. These instructions assume you have chosen /opt/docker/httpd as a base folder for storing settings and data. If you choose a different path, please update the path in the commands below accordingly.

  1. On the Docker host, create the docker-compose.yml file inside the /opt/docker/httpd folder. The format is shown below in the Docker Compose Configuration section.
  2. Create the necessary configuration and data folders.
    • host# mkdir -p /opt/docker/httpd/{conf,data,logs}
    • host# chmod 2750 /opt/docker/httpd/logs
  3. Pull the latest image from the registry:
    • host# docker-compose pull httpd
  4. Review the Container Initialization section below on how to configure the container with your own custom settings and listeners.
  5. Use docker-compose to bring up the container:
    • host# docker-compose up httpd

In the future, you can update the container by simply re-running docker-compose pull httpd followed by docker-compose up --force-recreate httpd. These commands will automatically pull the latest version of the image(s) from the registry and replace it without affecting your data or configurations.

Docker Compose Configuration

Below is a sample docker-compose.yml file for your reference:

# Sample configuration for 'httpd' container

version: "3"

    container_name: httpd
    image: dataknightllc/apache-http:stable
      - /opt/docker/httpd/conf:/etc/apache2/conf.d
      - /opt/docker/httpd/logs:/var/log/apache2
      - /opt/docker/httpd/data:/var/www/html
      - 80:80
      - 443:443
      TZ: ${TZ:-UTC}

Backing Up the Container

Once you have configured the container per the instructions above, you simply need to backup the /opt/docker/httpd folder and subfolders to save your configuration and data.

Container Initialization

Before you start the container for the first time, you will need to provide virtual host configurations for Apache as none are defined out of the box. Create standard Apache virtual host configurations and place them in the folder you mount for /etc/apache2/conf.d on the host. If no listeners are present, the container will fail to start. Be sure to map the appropriate ports in the docker-compose.yml file.

The default Apache configuration files for features such as SSL ciphers, HTTP/2, language support, etc. are stored in the container within the /etc/apache2/defaults folder. You can override a single file by mapping it appropriately in the docker-compose.yml file or override all the defaults by mounting the entire folder instead.

Finally, if you wish to use an alternate configuration file to /etc/apache2/httpd.conf, you can override the default configuration file by mounting /etc/default on your host and creating a file called httpd and setting the value for APACHE_CONFIG_FILE (eg: APACHE_CONFIG_FILE=/etc/httpd/apache.conf).

Troubleshooting Errors

If you have issues, be sure to check the log files in the /var/log/apache2 folder for details. The majority of information will be stored in the error.log file by default.

Additional Help or Questions

If you have questions, find bugs or need additional help, please send an email to

Docker Pull Command

Comments (0)