What if ports are different?

061

If the ports are different, you can specify them in the -p option like this: -p host_port:container_port.

For example, if you want to map port 8080 on your host to port 3000 in the container, you would use:

-p 8080:3000

In this case:

  • 8080: The port on your host machine.
  • 3000: The port inside the Docker container.

This means that when you access http://localhost:8080, it will route the traffic to port 3000 in the container.

Let me know if you need more information!

0 Comments

no data
Be the first to share your comment!