To expose just one port, this is what you need to do:
docker run -p <host_port>:<container_port>
To expose multiple ports, simply provide multiple -p
arguments:
docker run -p <host_port1>:<container_port1> -p <host_port2>:<container_port2>
More Related Contents:
- From inside of a Docker container, how do I connect to the localhost of the machine?
- Restrict Internet Access – Docker Container
- What does –net=host option in Docker command really do?
- How to execute command from one docker container to another
- docker-compose: difference between networks and links
- Docker 1.10 access a container by its hostname from a host machine
- What is the use of Docker ‘host’ and ‘none’ Networks?
- How to run shell script on host from docker container?
- docker: “build” requires 1 argument. See ‘docker build –help’
- Docker build “Could not resolve ‘archive.ubuntu.com'” apt-get fails to install anything
- What is a dangling image and what is an unused image?
- How to get a list of images on docker registry v2
- How to pass arguments within docker-compose?
- Docker mount to folder overriding content
- Why are Docker container images so large?
- How can I delete Docker’s images?
- How to use environment variables in docker-compose?
- Keycloak Docker HTTPS required
- How do I set environment variables during the build in docker
- How to set image name in Dockerfile?
- Docker – how can I copy a file from an image to a host?
- Using docker-compose with CI – how to deal with exit codes and daemonized linked containers?
- How to get Docker containers to talk to each other while running on my local host?
- How do I configure docker compose to expose ports correctly?
- Change directory command in Docker?
- Docker container doesn’t expose ports when –net=host is mentioned in the docker run command
- how do you manage secret values with docker-compose v3.1?
- Dockerfile: Output of RUN instruction into a Variable
- how does Docker Embedded DNS resolver work?
- What is the purpose of the file “docker.sock”?