March 2017
Beginner to intermediate
925 pages
18h 11m
English
There are a number of ways by which ports on the container can be exposed. One of them is through the run command, which we will cover in this chapter. The other ways are through the Docker file and the --link command. We will explore them in the other chapters.
Make sure the Docker daemon is running on the host and you can connect through the Docker client.
$ docker run --expose=PORT [ OPTIONS ] IMAGE[:TAG] [COMMAND] [ARG...]
For example, to expose port 22 while starting a container, run the following command:
$ docker run --expose=22 -i -t fedora /bin/bash
There are multiple ways to expose the ports for a container. For now, ...
Read now
Unlock full access