How to change apache port for OpenShift (4.x) deployment?


I want to deploy Nextcloud in OpenShift 4.x.
Is there a way how to change the port, where apache runs? The standard image uses 80 as non-root, but to get it running on OpenShift it has to be changed.

Error message:

could not bind to address [::]:80
could not bind to address no listening sockets available, shutting down


          - containerPort: 8443
            protocol: TCP

Complete yaml:

apiVersion: apps/v1
kind: Deployment
  name: nextcloud-server
    app: nextcloud
  replicas: 1
      pod-label: nextcloud-server-pod
        pod-label: nextcloud-server-pod
      - name: nextcloud
        image: nextcloud:apache
          - containerPort: 8443
            protocol: TCP
        - name: server-storage
          mountPath: /var/www/html
          subPath: server-data
      - name: server-storage
          claimName: nextcloud-shared-storage-claim

Any hint is welcome.

Brgds, Marc

You can change apache ports:

Question is for you where you run apache and where the configuration files can be found.

That is not my question. I asked for an improvement in the original Nextcloud image to define another Apache port with specifications. With this, you can then deploy with a different Apache port in Kubernetes/OpenShift without modifying the image.


If you want to create letsencrypt certificates, access Nextcloud from outside on different networks, you should deviate from default ports. A more proper way to solve that is to use different hostnames, e.g. and Apache and other servers support this name-based virtual hosting.

This is the second time you have answered me about something completely different from what I asked for.

It’s not about certificate or other hostnames. It is about the Apache port when deploying the container, which has to be changed by predefined parameters. I don’t see a workaround via postscript or other methods as useful.

Well, I sent you a link to the documentation where you can change the port. Where you find such files in your type of container, I don’t know that. But if you know the file you are looking for, you might be able to find it. I won’t have the time to do that for you.

And regarding this, I just wrote why your request is of special interest

because for many people the SSL certificates are important and they care about accessing their Nextcloud through Hotel or other wifis where non-standard ports are often blocked.

I don’t know who creates this image, you can ask them to add such an option to use different ports.

Thank you for coming.
All your information is helpful, but I have the ambition not to build a custom image.

It’s a known issue and I hope that following enhancement (reason for my post) will be integrated in

Docker Hub