Skip to Content
Linux Administration Cookbook
book

Linux Administration Cookbook

by Adam K. Dean
December 2018
Beginner
826 pages
22h 54m
English
Packt Publishing
Content preview from Linux Administration Cookbook

How to do it...

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Linux Security Cookbook - Second Edition

Practical Linux Security Cookbook - Second Edition

Tajinder Kalsi
Mastering Linux Administration

Mastering Linux Administration

Alexandru Calcatinge, Julian Balog

Publisher Resources

ISBN: 9781789342529Supplemental Content