Parallels Docker Port Forwarding is a service that automatically manages port forwarding for Docker containers running inside a Parallels VM.
- Automatically detects running Docker containers and their exposed ports.
- Sets up port forwarding rules from the host to the Parallels VM.
- Monitors Docker events and updates port forwarding rules dynamically.
- Python 3.8+
- Poetry
- Docker SDK for Python
- Parallels Desktop with
prlctl
andprlsrvctl
command-line tools - Docker configured to accept TCP connections on the VM
-
Edit the Docker service configuration file:
Open the Docker service configuration file in your VM. This is usually located at
/lib/systemd/system/docker.service
.sudo nano /lib/systemd/system/docker.service
-
Modify the
ExecStart
line:Find the line that starts with
ExecStart
and modify it to include the-H tcp://0.0.0.0:2375
option. It should look something like this:ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
-
Reload the systemd configuration and restart Docker:
sudo systemctl daemon-reload sudo systemctl restart docker
-
Verify that Docker is listening on TCP port 2375:
sudo netstat -tlpn | grep dockerd
You can install the package using pip:
pip install parallels-docker-port-forwarding
To start the port forwarding service, run:
parallels-docker-port-forwarding --vm-name "Your VM Name"
If the VM name is not provided, the default VM name 'Ubuntu 22.04.2 (x86_64 emulation)'
will be used.
To set up the development environment:
- Clone the repository:
git clone https://github.com/imtpot/parallels-docker-port-forwarding.git
cd parallels-docker-port-forwarding
- Install dependencies using Poetry:
poetry install
- Run the service:
poetry run parallels-docker-port-forwarding --vm-name "Your VM Name"
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.