Docker container management library for Python
Project description
minicloud
Docker container management library for Python. Create and manage VPS containers with SSH access.
Installation
pip install minicloud
Quick Start
from minicloud import CloudManager
dm = CloudManager()
# Create a container
container = dm.create_container(
name="my-app",
ram=512,
cpu=100,
disk=10,
port=3000,
ssh_password="mypassword"
)
print(f"Container ID: {container['container_id']}")
Usage
Create Container
from minicloud import CloudManager
dm = CloudManager()
container = dm.create_container(
name="my-app",
ram=512, # 512 MB RAM
cpu=100, # 1 CPU core (100 = 1 core)
disk=10, # 10 GB disk
port=3000, # SSH port
image="ubuntu:22.04",
ssh_password="secure-password"
)
List Containers
containers = dm.list_containers()
for c in containers:
print(f"{c['name']}: {c['status']}")
Get Container Info
info = dm.get_container_info("my-app")
print(f"Status: {info['status']}")
print(f"Port: {info['port']}")
Get Container Stats
stats = dm.get_container_stats("my-app")
print(f"CPU: {stats['cpu_percent']}%")
print(f"Memory: {stats['memory_used']}/{stats['memory_limit']} MB")
Start/Stop/Restart
dm.start_container("my-app")
dm.stop_container("my-app")
dm.restart_container("my-app")
Delete Container
dm.delete_container("my-app")
Server Info
server = dm.get_server_info()
print(f"Hostname: {server['hostname']}")
print(f"Available RAM: {server['available_ram']} MB")
print(f"Containers: {server['containers_count']}")
Custom Configuration
Custom Prefix
dm = CloudManager(prefix="vps")
# Containers will be named: vps_my-app
Custom Allowed Images
dm = CloudManager(allowed_images=[
"ubuntu:22.04",
"debian:12",
"nginx:latest",
])
Error Handling
from minicloud import CloudManager, ContainerAlreadyExistsError, ImageNotAllowedError
try:
dm.create_container(
name="my-app",
ram=512,
cpu=100,
disk=10,
port=3000
)
except ContainerAlreadyExistsError:
print("Container already exists")
except ImageNotAllowedError as e:
print(f"Image not allowed: {e}")
Available Images
Default allowed images:
ubuntu:22.04ubuntu:20.04debian:12debian:11alpine:latestcentos:7
Resource Limits
| Resource | Min | Max |
|---|---|---|
| RAM | 128 MB | 16384 MB |
| CPU | 10% | 400% (4 cores) |
| Disk | 1 GB | 100 GB |
| Port | 1024 | 65535 |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
minicloud-1.0.0.tar.gz
(7.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file minicloud-1.0.0.tar.gz.
File metadata
- Download URL: minicloud-1.0.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94ab2d288a3dac2564da8afed3daf227b1c4c0599640050bda7149374bd792ca
|
|
| MD5 |
79ff71eb91d95eec80f76093a168f007
|
|
| BLAKE2b-256 |
4d53b085fa46f1292e0187d1073cfaaa2e4b365fb71688623b5fbaa23f551efa
|
File details
Details for the file minicloud-1.0.0-py3-none-any.whl.
File metadata
- Download URL: minicloud-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65bf1944dc92546cbfd5724c8416a2c7ddfc5cb8608113f850e4a4ba781985c3
|
|
| MD5 |
ac1856b2add57fab019bcaa3760417b1
|
|
| BLAKE2b-256 |
8ab8c1be55dcde41f6c8ba9b8a6081beca5d9e4ddc98750aa46d559d3ae1e5fb
|