Skip to main content

A Docker container port forwarding service for Parallels

Project description

Parallels Docker Port Forwarding

Parallels Docker Port Forwarding is a service that automatically manages port forwarding for Docker containers running inside a Parallels VM.

Features

  • 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.

Requirements

  • Python 3.8+
  • Poetry
  • Docker SDK for Python
  • Parallels Desktop with prlctl and prlsrvctl command-line tools
  • Docker configured to accept TCP connections on the VM

Setting up Docker to accept TCP connections on the VM

  1. 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
    
  2. 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
    
  3. Reload the systemd configuration and restart Docker:

    sudo systemctl daemon-reload
    sudo systemctl restart docker
    
  4. Verify that Docker is listening on TCP port 2375:

    sudo netstat -tlpn | grep dockerd
    

Installation

You can install the package using pip:

pip install parallels-docker-port-forwarding

Usage

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.

Development

To set up the development environment:

  1. Clone the repository:
git clone https://github.com/yourusername/parallels-docker-port-forwarding.git
cd parallels-docker-port-forwarding
  1. Install dependencies using Poetry:
poetry install
  1. Run the service:
poetry run parallels-docker-port-forwarding --vm-name "Your VM Name"

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parallels_docker_port_forwarding-0.1.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file parallels_docker_port_forwarding-0.1.2.tar.gz.

File metadata

File hashes

Hashes for parallels_docker_port_forwarding-0.1.2.tar.gz
Algorithm Hash digest
SHA256 736440c9bcb58121751a40ddb04177938a2fc945644dd0a85f3c225dfec42be5
MD5 f274f40297c82e917c96edbc46790619
BLAKE2b-256 3565c6f0c4f72f73ffdba93e7888bc7830ce4f8c6948eaeb6abbc94c6d35abdc

See more details on using hashes here.

File details

Details for the file parallels_docker_port_forwarding-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for parallels_docker_port_forwarding-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 827f15442d1001bd23a42ddd4cb10ab812e2de6c51ff3506e9c8644e6e3d4267
MD5 ef9930fd09095718fc134b522f01b549
BLAKE2b-256 02bf6eddd18c1fbe5d21f405823385211aaef6f16db2f52b2c115e4743ea8e5e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page