December 2018
Beginner
826 pages
22h 54m
English
You should now have a running docker container, listed here with docker ps:
$ sudo docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES0f649283dcaf alpine "/bin/ash" 41 seconds ago Up 39 seconds 0.0.0.0:8080->8080/tcp compassionate_boyd
Note that we also have a port forwarded in this example, namely port 8080.
Port forwarding in this instance is the same as any other—we're forwarding a port from the host to a port in the container.
Try to curl the port:
$ curl localhost:8080curl: (56) Recv failure: Connection reset by peer
Now, jump into the VM and let's start a web server on the specified port:
$ sudo docker exec -it compassionate_boyd /bin/ash
First, we need to install some additional busybox things:
# apk add ...