I donât know if this is possible with just the compose file⌠You could do that with a custom image. But why would you like to do it in the first place? You can bind whatever port you like to the exposed port of the container.
if you really want to do it: search for the vhost conf file where âlisten :80â is defined, copy it to your host, change it to âlisten :8888â and include this file in your docker-compose volume definition.
but as chartman123 said already: âwhy you want to do this?â
maybe you get confused with container exposed port and the port you use to access from outside.
most likely you are looking for
ports:
- 8888:80
which means the container keeps using default port 80 and you use port 8888 on your docker server to access this container. there is no reason to change the exposed port of the docker container⌠there is no obligation to have 1:1 relation of the host port and container port. even if you run multiple Nextcloud containers in parallel each container can keep using port 80 on their side - you only need unique port on the host side (or even better expose multiple systems with reverse proxy like traefik and different domains (nc1.mycloud.com, nc2.mycloud.com etcâŚ) on well known port like http or https so you donât need to add port manually when you access the instanceâŚ