I'm having trouble changing the port for a service in my Docker Compose file. I want to deploy the 'homepage' service which defaults to port 3000, but that port is already in use by my AdGuard. I need to set it to a different port, but I'm not sure how to configure this in my docker-compose.yml file. Here's a snippet of what I have:
services:
homepage:
image: ghcr.io/gethomepage/homepage:latest
ports:
- 3000:3000
I've tried changing it to 3030:3030 and even 9644:9644, but I'm not sure if I'm doing it right. Any guidance would be really appreciated!
3 Answers
To reiterate what the others said, it’s crucial to match the container port to what the service uses inside. If your service is listening on port 3000, then your host port can be changed freely, just ensure it’s not the same as another service!
Make sure you're clear on the port mapping concept! It’s always :. The container is listening on port 3000, so keep that on the right side when changing the left.
You just need to change the left side of the port mapping in your Docker Compose file. The format is `:`, so you can switch it to something like 3030:3000 or 9644:3000 to free up port 3000 for your AdGuard.
Related Questions
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically
[Centos] Delete All Files And Folders That Contain a String