Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to change port inside container #62

Open
GFNiko opened this issue Jan 27, 2023 · 5 comments
Open

Request to change port inside container #62

GFNiko opened this issue Jan 27, 2023 · 5 comments

Comments

@GFNiko
Copy link

GFNiko commented Jan 27, 2023

As I am using IPVLAN Layer 3 in my docker setup, every microservice gets its own ip address. Therefore I don't need different ports. And docker doesn't support port rebinding in an ipvlan L3. So I want to change the given port 5000 to 80, so I dont have the local dns record of 192.168.10.5:5000 to snip.homelab:5000. Let me change it to 192.168.10.5:80 therefore just http://snip.box please
When I run the docker run command
docker run -d --network=home_lab --ip=192.168.10.5 --name=snippetbox --restart=always -v ~/docker/config:/config pawelmak/snippet-box:latest it binds it to the port 5000, even I put --bind :80 or -p 80:80 to the command. How do I use it without port 5000

@schklom
Copy link

schklom commented Feb 4, 2023

Why not use a different port, like -p 80:5000?
This does not seem like a rare edge case where you need container port 80.

@GFNiko
Copy link
Author

GFNiko commented Feb 5, 2023

Becasue docker's IPVLAN ignores ports

@schklom
Copy link

schklom commented Feb 5, 2023

Oh, I didn't know that.
Unless the dev fixes this, you could link snippet-box to a reverse-proxy and expose the reverse-proxy's port. A basic nginx config would do.

@codesterd
Copy link

I usually just change the EXPOSE port in the Dockerfile and build it.

https://www.mend.io/free-developer-tools/blog/docker-expose-port/

@schklom
Copy link

schklom commented Feb 9, 2023

@codesterd I don't think that is enough. The software needs to listen on that port.
Also, you don't need to build the Dockerfile if all you change is EXPOSE, this can be changed in your docker-compose.yml or docker run command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants