This is a docker project that is used to spin up an apache2 web server.
To run the cisagov/apache2
image via Docker:
docker run cisagov/apache2:latest
-
Use the
docker-compose.yml
file similar to the one below to use Docker Compose.--- version: "3.7" # This Docker composition file is used to build and test the container secrets: quote_txt: file: ./src/secrets/quote.txt services: http-redirector: # Run the container normally build: # VERSION must be specified on the command line: # e.g., --build-arg VERSION=0.0.1 context: . dockerfile: Dockerfile image: cisagov/apache2:latest container_name: apache init: true restart: "no" ports: - '80:80' - '443:443' volumes: - ./src/:/var/www/html - ./src/config/apache2.conf:/etc/apache2/apache2.conf - ./src/config/000-default.conf:/etc/apache2/sites-available/000-default.conf
-
Start the container and detach:
docker compose up --detach
-
Pull the new image from Docker Hub:
docker compose pull
-
Recreate the running container by following the previous instructions:
docker compose up --detach
-
Stop the running container:
docker stop <container_id>
-
Pull the new image:
docker pull cisagov/apache2:latest
-
Recreate and run the container by following the previous instructions.
Mount point | Purpose |
---|---|
/src/ |
webroot |
/src/config |
configuration of the server |
The following ports are exposed by this container:
Port | Purpose |
---|---|
80 | http |
443 | https |
The sample Docker composition publishes the exposed port at 80 & 443.
There are no required environment variables.
To create images that are compatible with other platforms, you can use the
buildx
feature of
Docker:
-
Copy the project to your machine using the
Code
button above or the command line:git clone https://github.com/cisagov/apache2-docker.git cd apache2-docker
-
Create the
Dockerfile-x
file withbuildx
platform support:./buildx-dockerfile.sh
-
Build the image using
buildx
:docker buildx build \ --file Dockerfile-x \ --platform linux/amd64 \ --output type=docker \ --tag cisagov/apache2:latest.
Please see our Project Setup guide for step-by-step instructions on how to start a new repository from a skeleton. This will save you time and effort when configuring a new repository!
We welcome contributions! Please see CONTRIBUTING.md
for
details.
This project is in the worldwide public domain.
This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.
All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.