Docker Machine Port Forwarder

Simple bash script that makes it easier to forward ports from Docker Machine
Alternatives To Docker Machine Port Forwarder
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Nginx Proxy16,893
3 days ago451mitPython
Automated nginx proxy for Docker containers using docker-gen
19 days ago17April 27, 2022117gpl-3.0Rust
🤖 The Modern Port Scanner 🤖
Kafka Docker6,521
7 days ago121apache-2.0Shell
Dockerfile for Apache Kafka
14 days ago20apache-2.0Shell
a Docker + Kubernetes network trouble-shooting swiss-army container
Maildev3,88654267 days ago44May 18, 2022111otherSCSS
:mailbox: SMTP Server + Web Interface for viewing and testing emails during development.
Ufw Docker2,681
4 days ago48gpl-3.0Shell
To fix the Docker and UFW security flaw without disabling iptables
Play With Docker2,488
20 days ago10September 07, 202178mitJavaScript
You know it, you use it, now it's time to improve it. PWD!.
Youtubedl Material1,825
2 days ago218mitTypeScript
Self-hosted YouTube downloader built on Material Design
Docker Registry Frontend1,520
2 years ago82mitJavaScript
Browse and modify your Docker registry in a browser.
10 days ago19mitShell
A Docker image for Discourse
Alternatives To Docker Machine Port Forwarder
Select To Compare

Alternative Project Comparisons

Docker Machine Port Forwarding

A small bash script that makes it easier to expose ports between docker-machine (VirtualBox or macOS hypervisor like xhyve, HyperKit etc.) and the host when using Docker Machine on macOS. The script is called pf which stands for "port forward". You can also read more on this blog.


$ pf 8080

Forwards port 8080 in the container to port 8080 on the host in docker-machine environment default by opening an SSH connection to VirtualBox in the background.

If you run into this error:

Host does not exist: "default"

you'll need to specify the name of your docker-machine environment. For example:

$ pf 8080 -e dev

This will use the dev docker-machine environment.

Stopping the port forwarding

If you've started port forwarding in the background (default) you can easily stop it using:

$ pf 8080 -s

Note that you don't need to specify an environment (-e) for this to work.

Port Mapping

You can map the docker port to another port on the host like this:

$ pf 8090:8080

This will map port 8090 on the host to port 8080 running in the container.


You can also start the port forwarding process in the foreground:

$ pf 8080 -f

If you do this you'll see the docker-machine and once it's shutdown the port forwarding is also stopped automatically (i.e. no need to run pf 8080 -s).


Run pf -h to for more options


If you need more advanced options just use the vanilla docker-machine command. The purpose of pf is to make it really easy to do the most basic things.

Popular Docker Projects
Popular Port Projects
Popular Virtualization Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Bash Script
Docker Machine