Home > Net >  How do I serve two ports in Docker bounded to one?
How do I serve two ports in Docker bounded to one?

Time:03-17

Let's suppose I have a Dockerfile like this:

...
EXPOSE 5000
...
CMD ["myserver", "--port", "5000"]

So if I want this container to serve port 80 for example, I would run it like this:

docker run -p 80:5000 ...

What do I need to do if I want this container to serve two different ports (for example, 80 and 88) as one bounded to 5000? I tried this without any success:

docker run -p 80,88:5000 ...

And is it legal what I want to have?

CodePudding user response:

I don't see the use case but you can run it like this

docker run -p 80:5000 -p 88:5000 ...

  • Related