Container
Quản lý thiết lập container: cập nhật image container, đặt giới hạn tài nguyên chung cho container, v.v.
docker
Lệnh này mở shell tương tác vào container của người dùng.
Để xem danh sách mọi người dùng:
hitechcloudcli docker
Để xem danh sách container đang chạy của một người dùng:
hitechcloudcli docker <USERNAME>
Để mở terminal trực tiếp trong một container của người dùng:
hitechcloudcli docker <USERNAME> <container>
Images
Dùng Cup 🥤 để kiểm tra bản cập nhật image và hiển thị chúng tại HiTechCloud > Container > Cập nhật image
Kiểm tra bản cập nhật image cho một người dùng cụ thể:
hitechcloudcli docker-images <USERNAME>
Ví dụ:
root@test:/usr/local/hitechcloudcli# hitechcloudcli docker-images s70nesto
Running Cup in context: s70nesto
Output for user s70nesto saved to /home/s70nesto/docker-data/cup/cup.json
{"images":[{"in_use":false,"parts":{"registry":"registry-1.docker.io","repository":"shinsenter/php","tag":"8.2-fpm"},"reference":"shinsenter/php:8.2-fpm","result":{"error":null,"has_update":true,"info":{"current_version":"8.2","new_tag":"8.4-fpm","new_version":"8.4","type":"version","version_update_type":"minor"}},"server":null,"time":276,"url":"https://hub.docker.com/r/shinsenter/php/tags"},{"in_use":true,"parts":{"registry":"ghcr.io","repository":"sergi0g/cup","tag":"latest"},"reference":"ghcr.io/sergi0g/cup:latest","result":{"error":null,"has_update":false,"info":null},"server":null,"time":162,"url":"https://hitechcloud.org"},{"in_use":true,"parts":{"registry":"registry-1.docker.io","repository":"mcuadros/ofelia","tag":"latest"},"reference":"mcuadros/ofelia:latest","result":{"error":null,"has_update":false,"info":null},"server":null,"time":575,"url":"https://hitechcloud.org"},{"in_use":false,"parts":{"registry":"registry-1.docker.io","repository":"library/mysql","tag":"8.0"},"reference":"mysql:8.0","result":{"error":null,"has_update":true,"info":{"current_version":"8.0","new_tag":"9.3","new_version":"9.3","type":"version","version_update_type":"major"}},"server":null,"time":549,"url":null},{"in_use":false,"parts":{"registry":"registry-1.docker.io","repository":"library/phpmyadmin","tag":"latest"},"reference":"phpmyadmin:latest","result":{"error":null,"has_update":true,"info":{"local_digests":["sha256:5f37deab81ddca73cb44de568ecbe0109fd738a76d614f41833f6b0788ad4012"],"remote_digest":"sha256:db901a16f662cfa7857b55353883e91ce1dc45cfadf57e9631bb44a38274e69b","type":"digest"}},"server":null,"time":550,"url":"https://hitechcloud.org"},{"in_use":false,"parts":{"registry":"registry-1.docker.io","repository":"library/httpd","tag":"latest"},"reference":"httpd:latest","result":{"error":null,"has_update":true,"info":{"local_digests":["sha256:f6557a77ee2f16c50a5ccbb2564a3fd56087da311bf69a160d43f73b23d3af2d"],"remote_digest":"sha256:1ae8051591a5ded56e4a3d7399c423e940e8475ad0e5adb82e6e10893fe9b365","type":"digest"}},"server":null,"time":552,"url":null}],"metrics":{"major_updates":1,"minor_updates":1,"monitored_images":6,"other_updates":2,"patch_updates":0,"unknown":0,"up_to_date":2,"updates_available":4}}
Kiểm tra bản cập nhật image cho mọi người dùng:
hitechcloudcli docker-images --all
logs
Xem dung lượng nhật ký của container người dùng và container hệ thống.
# hitechcloudcli docker-logs
Usage: hitechcloudcli docker-logs [options]
Options:
<USERNAME> Display log sizes for specified user.
--system Display log sizes just for system containers.
--users Display log sizes just for user containers.
--all Display log sizes for all user and system containers.
Examples:
hitechcloudcli docker-logs stefan
hitechcloudcli docker-logs --users
hitechcloudcli docker-logs --system
hitechcloudcli docker-logs --all
Thu thập thống kê
Để thu thập thông tin sử dụng tài nguyên của container (cpu, ram, i/o) cho mọi người dùng:
hitechcloudcli docker-collect_stats
Script collect_stats cũng xoay vòng dữ liệu theo thiết lập resource_usage_retention
Giới hạn (KHÔNG CÒN DÙNG)
Đặt giới hạn chung (dung lượng lưu trữ, ram và cpu) cho mọi container hệ thống.
hitechcloudcli docker-limits [--apply | --read]
Để xem giới hạn hiện tại:
hitechcloudcli docker-limits --read
Ví dụ:
root@stefan:~# hitechcloudcli docker-limits --read
[DOCKER]
max_ram=90
max_cpu=95
max_disk=114
Giới hạn CPU và RAM
Để áp dụng giới hạn mới cho CPU % và RAM %:
hitechcloudcli docker-limits --apply
Giới hạn dung lượng lưu trữ (đĩa)
Để tăng dung lượng lưu trữ (đĩa) cấp cho container, truyền kích thước tính bằng GB:
hitechcloudcli docker-limits --apply 100