Preface
Two methods for provisioning containers.
Single Container Provisioning
- Creates a single Podman container, automatically detects international or China mainland server
- Can configure binding of an independent IPv6 address (requires host with public IPv6 and podman-ipv6 network configured during installation)
- Supports x86_64 and ARM64 architecture servers
Download Script
International
shell
wget -q https://raw.githubusercontent.com/oneclickvirt/podman/main/scripts/onepodman.sh
chmod +x onepodman.sh1
2
2
China Mainland
shell
wget -q https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/podman/main/scripts/onepodman.sh
chmod +x onepodman.sh1
2
2
Example
Supported variables for running:
bash
./onepodman.sh <name> <cpu> <memory_mb> <password> <sshport> <startport> <endport> [independent_ipv6:y/n] [system] [disk_gb]1
Currently supported system values:
- debian
- ubuntu
- alpine
- almalinux
- rockylinux
- openeuler
Default is debian if not specified.
shell
./onepodman.sh ct1 1 512 MyPassword 25000 34975 35000 n debian 01
Example container information:
| Attribute | Value |
|---|---|
| Container name | ct1 |
| SSH username | root |
| SSH password | MyPassword |
| CPU cores | 1 |
| Memory | 512MB |
| SSH port | 25000 |
| External/internal port range | 34975 to 35000 |
| System | debian |
| Independent IPv6 | N |
| Disk size | Unlimited |
Related Operations
List all containers
shell
podman ps -a1
Enter container
shell
podman exec -it ct1 bash1
Enter Alpine container
shell
podman exec -it ct1 sh1
Type exit to leave the container.
Delete container
shell
podman rm -f ct11
View container logs
shell
podman logs ct11
Batch Container Provisioning
- Multiple runs inherit configuration and generate sequentially
- Auto-increments container name (ct1, ct2, ...), SSH port, and public ports
- Container information recorded to
ctlogfile - Recommended to run in screen to avoid SSH disconnection
Run
International
shell
wget -q https://raw.githubusercontent.com/oneclickvirt/podman/main/scripts/create_podman.sh
chmod +x create_podman.sh
./create_podman.sh1
2
3
2
3
China Mainland
shell
wget -q https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/podman/main/scripts/create_podman.sh
chmod +x create_podman.sh
./create_podman.sh1
2
3
2
3
Query Batch Container Information
shell
cat ctlog1
Output format:
container_name ssh_port root_password cpu_cores memory_mb start_port end_port disk_gb1
One line per container.
Remove All Containers and Images
shell
podman ps -aq | xargs -r podman rm -f
podman images -aq | xargs -r podman rmi -f
podman volume prune -f
podman system prune -af
rm -rf ctlog1
2
3
4
5
2
3
4
5
Restart All Containers After Host Reboot
Podman supports systemd integration. Generate auto-start service for a container:
shell
# Generate systemd service for a specific container
podman generate systemd --name ct1 > /etc/systemd/system/container-ct1.service
systemctl enable container-ct11
2
3
2
3
Or manually start all stopped containers:
shell
podman ps -aq -f status=exited | xargs -r podman start1
