How do I expose multiple port with Docker?

1.1K    Asked by SophiaAllen in Data Science , Asked on Jul 13, 2021

I want to expose multiple ports to the machine’s interface.

How to achieve this using a docker container?

Please help.

Answered by Ranjana Admin

To resolve dockerfile expose multiple ports:

1. Docker is a tool that is designed for tasks like create, deploy and run applications easier by using containers.

2. Containers can allow a developer to pack up an application with all of the parts it requires, like libraries and other dependencies, and ship it all out as one package.

3. To expose multiple ports with docker follow the code given below:

Syntax:

docker run -p : -p :

4. To expose a single port:

Syntax:

docker run -p :



Your Answer

Interviews

Parent Categories