{"id":16113023,"url":"https://github.com/tristanpoland/shiphelm","last_synced_at":"2026-05-12T07:41:43.339Z","repository":{"id":131757991,"uuid":"610801198","full_name":"tristanpoland/ShipHelm","owner":"tristanpoland","description":"A Python library built for the SkiffUI project used for interacting with Docker containers more easily","archived":false,"fork":false,"pushed_at":"2023-06-30T23:06:13.000Z","size":134,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-06T05:59:00.254Z","etag":null,"topics":["docker","kubernetes","library","multiplatform","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tristanpoland.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Gameplex-Software","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-03-07T14:07:51.000Z","updated_at":"2024-06-30T01:07:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"93ed6f90-70a2-41fc-8175-2cc95c9df181","html_url":"https://github.com/tristanpoland/ShipHelm","commit_stats":null,"previous_names":["gameplex-software/shiphelm"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanpoland%2FShipHelm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanpoland%2FShipHelm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanpoland%2FShipHelm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanpoland%2FShipHelm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tristanpoland","download_url":"https://codeload.github.com/tristanpoland/ShipHelm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247447694,"owners_count":20940375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","kubernetes","library","multiplatform","python"],"created_at":"2024-10-09T20:09:59.601Z","updated_at":"2026-05-12T07:41:38.290Z","avatar_url":"https://github.com/tristanpoland.png","language":"Python","funding_links":["https://github.com/sponsors/Gameplex-Software"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://gameplex-software.github.io/ShipHelm/\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/34868944/223447636-3e17dee3-ccdf-44cc-8d42-91378ced6708.png\" width=\"400\" /\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n# Shiphelm\n\n## Table of Contents\n\n- [Shiphelm](#shiphelm)\n  * [Table of Contents](#table-of-contents)\n  * [Installation](#installation)\n  * [Docker usage example](#docker-usage-example)\n    + [Standalone Docker installation](#standalone-docker-installation)\n    + [Remote standalone Docker installation](#remote-standalone-docker-installation)\n    + [Remote Docker swarm installation](#remote-docker-swarm-installation)\n    + [Get a List of Running Containers](#get-a-list-of-running-containers)\n    + [Get a running container by ID](#get-a-running-container-by-id)\n    + [Get Stats and Ports for a Container by ID](#get-stats-and-ports-for-a-container-by-id)\n    + [Search for Containers by Name](#search-for-containers-by-name)\n    + [Change the Ports of a Container](#change-the-ports-of-a-container)\n    + [Rename a Container](#rename-a-container)\n    + [Add and Remove Containers from Networks](#add-and-remove-containers-from-networks)\n    + [Create and Delete Networks](#create-and-delete-networks)\n    + [Run a New Container](#run-a-new-container)\n    + [Generate run command](#generate-run-command)\n    + [Get and Set Environment Variables for a Container](#get-and-set-environment-variables-for-a-container)\n    + [Get and Set Volumes for a Container](#get-and-set-volumes-for-a-container)\n    + [Example code](#example-code)\n  * [Kubernetes (K8S) usage example](#kubernetes--k8s--usage-example)\n    + [Get a List of Running pods](#get-a-list-of-running-pods)\n    + [Get Stats and Ports for a pod by ID](#get-stats-and-ports-for-a-pod-by-id)\n    + [Search for pods by Name](#search-for-pods-by-name)\n    + [Change the Ports of a pod](#change-the-ports-of-a-pod)\n    + [Rename a pod](#rename-a-pod)\n    + [Add and Remove pods from Networks](#add-and-remove-pods-from-networks)\n    + [Create and Delete Networks](#create-and-delete-networks-1)\n    + [Run a New pod](#run-a-new-pod)\n    + [Generate run command](#generate-run-command-1)\n    + [Get and Set Environment Variables for a pod](#get-and-set-environment-variables-for-a-pod)\n    + [Get and Set Volumes for a pod](#get-and-set-volumes-for-a-pod)\n    + [Example code](#example-code-1)\n  * [Dynamic engine selection](#dynamic-engine-selection)\n  * [Remote engines via GUI](#remote-engines-via-gui)\n- [Contributing](#contributing)\n\nShiphelm is a Python library for interacting with containers more easily. With Shiphelm, you can:\n\n- Get a list of all running containers\n- Get usage statistics and used ports for a given container by ID\n- Search containers by name or ID\n- Change the open ports of a container\n- Run new containers\n- Work with Docker, and Kubernetes\n- Use Kubernetes clusters and Docker Swarm\n- work on clusters, and swarms of container hosts\n\n## Installation\n\nYou can install Shiphelm using pip:\n\n```\npip install shiphelm\n```\nPyPI: [https://pypi.org/project/Shiphelm/]()\n\nGitHub Releases [https://github.com/Gameplex-Software/ShipHelm/releases]()\n\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/34868944/231290469-900a253f-1236-4dd3-a126-85177931ce53.png\" width=\"1000\" /\u003e\n\u003c/p\u003e\n\n## Docker usage example\n\nThis code will allow you to manage the local container engine\n\n\n### Standalone Docker installation\n```\nfrom shiphelm.helm import helm\n\nhd = helm() # create an instance of helm\n\nhelm.set_engine_manual(\"docker\")\n```\n\n### Remote standalone Docker installation\n\nThis code will allow you to manage any compatible remote container engine\n```\nfrom shiphelm.helm import helm\n\nhd = helm.reomte_connect('tcp://remote-docker-host:2375') # create an instance of helmdocker for romote management\n```\n\n### Remote Docker swarm installation\n\n```\nfrom shiphelm.helm import helm\n\nhd = helm.helm() # create an instance of helm\n\nhelm.set_engine_manual(engine_select=\"docker\", remoteAddress=\"YOUR ADDRESS HERE\", remoteSecurity=\u003cTrue|False\u003e)\n```\n\n### Get a List of Running Containers\n\n```\nrunning_containers = hd.get_running_containers()\n``` \n\n### Get a running container by ID\n\n```\nget_container_by_id(container_id)\n```\n\n### Get Stats and Ports for a Container by ID\n\n```\ncontainer_stats = hd.get_container_stats(container_id)\ncontainer_ports = hd.get_container_ports(container_id)\n```\n\n### Search for Containers by Name\n\n```\ncontainers_by_name = hd.search_containers(name)\n``` \n\n### Change the Ports of a Container\n```\nhd.change_container_ports(container_id, ports)\n``` \n\n### Rename a Container\n\n```\nhd.rename_container(container_id, new_name)\n``` \n\n### Add and Remove Containers from Networks\n\n```\nhd.add_container_to_network(container_id, network_name)\nhd.remove_container_from_network(container_id, network_name)\n``` \n\n### Create and Delete Networks\n\n```\nhd.create_network(network_name)\nhd.delete_network(network_name)\n``` \n\n### Run a New Container\n\n```\ncontainer = hd.run_container(\n    image=image,\n    command=command,\n    detach=detach,\n    ports=ports,\n    environment=environment,\n    volumes=volumes\n)\n``` \n\n### Generate run command\nShipHelm is capable of retrieving your container's inspect data and re-creating the original command that was used to run your pod, allowing you to re-create it anywhere\n\n```\ncontainer_name = \"your_container_name\"\nnamespace = \"your_namespace\"  # Default is \"default\"\nrun_command = get_kubernetes_run_command(pod_name, namespace)\nprint(f\"Run command for pod {pod_name} in namespace {namespace}: {run_command}\")\n```\n\n### Get and Set Environment Variables for a Container\n\n```\ncontainer_environment = hd.get_container_environment(container_id)\nhd.set_container_environment(container_id, environment)\n``` \n\n### Get and Set Volumes for a Container\n\n```\ncontainer_volumes = hd.get_container_volumes(container_id)\nhd.set_container_volumes(container_id, volumes)\n```\n### Example code\nThis example runs 4 instances of the Docker \"Getting Started\" container\n\n```\nfrom shiphelm.helmdocker import helmdocker\n\nhd = helmdocker() # create an instance of helmdocker\ncontainer_list = hd.get_running_containers() # call the method on the instance\nprint(container_list)\nw=0\n\nprint(\"Preparing new server...\")\nwhile w\u003c3:\n    hd.run_container(image=\"docker/getting-started\", detach=1)\n    w=w+1\n\nprint(\"Your server is up and ready for connection!\")\n```\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/34868944/231290322-e18c1082-89e2-4b8a-abb3-8aee93f57bf9.png\" width=\"1000\" /\u003e\n\u003c/p\u003e\n\n## Kubernetes (K8S) usage example\n\nThis code will allow you to manage the local container engine\n\n```\nfrom shiphelm.helm import helm\n\nhd = helm.helm() # create an instance of helm\n\nhelm.set_engine_manual(\"kubernetes\")\n```\n\nThis code will allow you to manage any compatible remote container engine\n```\nfrom shiphelm.helm import helm\n\nhd = helm.reomte_connect('tcp://remote--host:2375') # create an instance of helm for romote management\n```\n\n### Get a List of Running pods\n\n```\nrunning_containers = hd.get_running_containers()\n``` \n\n### Get Stats and Ports for a pod by ID\n\n```\ncontainer_stats = hd.get_container_stats(container_id)\ncontainer_ports = hd.get_container_ports(container_id)\n```\n\n### Search for pods by Name\n\n```\ncontainers_by_name = hd.search_containers(name)\n``` \n\n### Change the Ports of a pod\n\n```\nhd.change_container_ports(container_id, ports)\n``` \n\n### Rename a pod\n\n```\nhd.rename_container(container_id, new_name)\n``` \n\n### Add and Remove pods from Networks\n\n```\nhd.add_container_to_network(container_id, network_name)\nhd.remove_container_from_network(container_id, network_name)\n``` \n\n### Create and Delete Networks\n\n```\nhd.create_network(network_name)\nhd.delete_network(network_name)\n``` \n\n### Run a New pod\n\n```\ncontainer = hd.run_container(\n    image=image,\n    command=command,\n    detach=detach,\n    ports=ports,\n    environment=environment,\n    volumes=volumes\n)\n``` \n\n### Generate run command\nShipHelm is capable of retrieving your pod's inspect data and re-creating the original command that was used to run your pod, allowing you to re-create it anywhere\n\n```\npod_name = \"your_pod_name\"\nnamespace = \"your_namespace\"  # Default is \"default\"\nrun_command = get_kubernetes_run_command(pod_name, namespace)\nprint(f\"Run command for pod {pod_name} in namespace {namespace}: {run_command}\")\n```\n\n### Get and Set Environment Variables for a pod\n\n```\ncontainer_environment = hd.get_container_environment(container_id)\nhd.set_container_environment(container_id, environment)\n``` \n\n### Get and Set Volumes for a pod\n\n```\ncontainer_volumes = hd.get_container_volumes(container_id)\nhd.set_container_volumes(container_id, volumes)\n```\n### Example code\nThis example runs 4 instances of the  \"Getting Started\" pod\n\n```\nfrom shiphelm.helm import helm\n\nhd = helm() # create an instance of helm\ncontainer_list = hd.get_running_containers() # call the method on the instance\nprint(container_list)\nw=0\n\nprint(\"Preparing new server...\")\nwhile w\u003c3:\n    hd.run_container(image=\"ollyw123/helloworld\", detach=1)\n    w=w+1\n\nprint(\"Your server is up and ready for connection!\")\n```\n\n## Dynamic engine selection\nYou may have noticed that the syntax for controling both Docker and Kubernetes are identical, the way the code you write for ShipHelm is run depends on the engine you selected last.\n\nIn the last example we used the follwing code to initilise ShipHelm, create an alias, and select a pod engine:\n\n```\nfrom shiphelm.helm import helm\n\nhd = helm.helm() # create an instance of helm\n\nhelm.set_engine_manual(\"kubernetes\")\n```\n\nf you want your cod to be able to use either engine that it detects locally you can use the following code instead:\n\n```\nfrom shiphelm.helm import helm\n\nhd = helm.helm() # create an instance of helm\n\nhelm.set_engine_auto()\n```\n\n## Remote engines via GUI\n\nTo use remote engines you can use the following the examples above to connect programatically or use the below code to open a GUI configuration wizard:\n\n```\nfrom shiphelm.helm import helm\n\nhd = helm.helm() # create an instance of helm\n\nhelm.remote_popup()\n```\n\n# Contributing\n\nIf you would like to contribute to SkiffUI, please feel free to open a pull request or issue on the [GitHub repository](https://github.com/Gameplex-Software/SkiffUI).\n\n\u003cscript src=\"https://giscus.app/client.js\"\n        data-repo=\"Gameplex-Software/ShipHelm\"\n        data-repo-id=\"R_kgDOJGgWLg\"\n        data-category=\"General\"\n        data-category-id=\"DIC_kwDOJGgWLs4CVv98\"\n        data-mapping=\"pathname\"\n        data-strict=\"0\"\n        data-reactions-enabled=\"1\"\n        data-emit-metadata=\"0\"\n        data-input-position=\"bottom\"\n        data-theme=\"light\"\n        data-lang=\"en\"\n        data-loading=\"lazy\"\n        crossorigin=\"anonymous\"\n        async\u003e\n\u003c/script\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftristanpoland%2Fshiphelm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftristanpoland%2Fshiphelm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftristanpoland%2Fshiphelm/lists"}