Mapping ports in Docker can be done using the `-p` or `—publish` option when running a docker container from an image.
The syntax for mapping ports is as follows:
```
docker run -p host-port:container-port image-name
```
Here:
- `host-port` is the port number on your machine.
- `container-port` is the port number in the Docker container.
- `image-name` is the name of the Docker image.
For example, if you want to run an application in a Docker container, which listens on port `5000`, and you want to access this application on your machine on port `8080`, you can run:
```
docker run -p 8080:5000 image-name
```
After running this, Docker will start a new container from `image-name`, and any connections made to `localhost` on port `8080` on your machine will be forwarded to port `5000` within the Docker container.
If you want to bind the container’s port to all IP Addresses (`0.0.0.0`), you can specify the IP address before the host port:
```
docker run -p 0.0.0.0:8080:5000 image-name
```