squeakywheel/apache2

By squeakywheel

Updated over 4 years ago

Image
0

293

Apache2 | Ubuntu

About Apache2

The Apache HTTP Server Project's goal is to build a secure, efficient and extensible HTTP server as standards-compliant open source software. The result has long been the number one web server on the Internet. Read more on the apache2 website.

Tags

  • 2.4.41-focal, 2.4.41, 2.4-focal, 2.4, 2-focal, 2, focal, beta - /!\ this is a beta release

Architectures supported

  • amd64, arm64, ppc64el, s390x

Usage

Docker CLI
$ docker run -d --name apache2 -p 8080:80 -e TZ=UTC squeakywheel/apache2:edge

You can now point your browser to http://localhost:8080/ and verify that it works.

Parameters

ParameterDescription
-e TZ=UTCTimezone.
-v /local/path/to/website:/var/www/htmlMount and serve a local website.
-p 8080:80Expose apache2 on localhost:8080.
-v /my/config/apache2.conf:/etc/apache2/apache2.confMount a local configuration apache2.conf (download this example file).
-v /local/path/to/website.conf:/etc/apache2/sites-enabled/website.confMount and serve a local website, usually as a VirtualHost.

Testing/Debugging

In case you need to debug what is happening with the container you can run docker logs <name_of_the_container>. To get access to an interactive shell run:

$ docker exec -it <name_of_the_container> /bin/bash
Deploy with Kubernetes

You can use your favorite Kubernetes distribution; if you don't have one, consider installing MicroK8s.

With microk8s running, enable the dns and storage add-ons:

$ microk8s enable dns storage
$ microk8s kubectl create configmap apache2-config --from-file=apache2=config/apache2.conf

Use the sample deployment yaml provided here. You will also need to download the contents of the html directory here

Apply the `apache2-deployment.yml` (click to expand)
# apache2-deployment.yml
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: apache2-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: apache2
  template:
    metadata:
      labels:
        app: apache2
    spec:
      containers:
      - name: apache2
        image: squeakywheel/apache2:edge
        volumeMounts:
        - name: apache2-config-volume
          mountPath: /etc/apache2/apache2.conf
          subPath: apache2.conf
        - name: apache2-config-volume
          mountPath: /srv/www/index.html
          subPath: index.html
        ports:
        - containerPort: 80
          name: apache2
          protocol: TCP
      volumes:
        - name: apache2-config-volume
          configMap:
            name: apache2-config
            items:
            - key: apache2
              path: apache2.conf
            - key: apache2-site
              path: index.html
---
apiVersion: v1
kind: Service
metadata:
  name: apache2-service
spec:
  type: NodePort
  selector:
    app: apache2
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
    nodePort: 30080
    name: apache
$ microk8s kubectl apply -f apache2-deployment.yml

You will now be able to connect to the Apache server on localhost:30080.

Bugs and Features request

If you find a bug in our image or want to request a specific feature file a bug here:

https://bugs.launchpad.net/ubuntu-docker-images/+filebug

In the title of the bug add apache2: <reason>.

Make sure to include:

  • The digest of the image you are using, you can find it using this command replacing <tag> with the one you used to run the image:
$ docker images --no-trunc --quiet squeakywheel/apache2:<tag>
  • Reproduction steps for the deployment
  • If it is a feature request, please provide as much detail as possible

Docker Pull Command

docker pull squeakywheel/apache2