这是本节的多页打印视图。 .
模块:DOCKER
Docker 是最流行的容器化平台,提供了标准化的软件交付能力。
Pigsty 本身并不依赖 Docker 部署任何组件,相反,它提供了部署安装 Docker 的能力,这是一个 可选模块。
Pigsty 提供一系列 Docker 软件/工具/应用模板,供您按需选用。 这允许用户快速拉起各种容器化的无状态软件工具模板,加装各种功能。 您可以使用外部由 Pigsty 托管的高可用数据库集群,将无状态的应用放入容器之中。
在执行 configure 时,Pigsty 会根据 region(如中国大陆网络环境)自动选择合适的软件源与镜像加速配置,以提升拉取镜像的速度与可用性。
您可以轻松配置 Registry 与 Proxy,以便灵活访问不同的镜像源。
1 - 使用方法
Pigsty 内置了 Docker 支持,您可以用它来快速部署容器化的应用软件。
上手
Docker 是一个 可选模块。在 Pigsty 中,Docker 是否安装由节点上的 docker_enabled 控制,默认不启用。
docker-ce 上游仓库归属于 infra 模块。若你需要在离线仓库中显式加入 Docker 包,可通过 repo_extra_packages 指定 docker 包别名(映射为 docker-ce 与 docker-compose-plugin)。
Docker 下载完之后,您需要在待安装 Docker 的节点上配置 docker_enabled: true 标记,并按需配置 其他参数。
最后,您可以使用 docker.yml 剧本将其安装到节点上:
安装
如果您只是临时性的希望在某些节点上,直接从互联网安装 Docker,那么可以考虑使用以下命令:
这条命令会在目标节点上,首先启用 node,infra 两个模块对应的上游软件源,然后安装 docker-ce 与 docker-compose-plugin 两个软件包(EL/Debian 同名)。
如果您希望的是在 Pigsty 初始化的时候就自动下载好 Docker 相关软件包,请参考下面的说明。
卸载
因为过于简单,Pigsty 不提供 Docker 模块的卸载剧本,你可以直接使用 Ansible 指令移除 Docker
下载
想要在 Pigsty 安装过程中下载 Docker,在 配置清单 中确认 repo_modules 包含 infra(Docker 上游所在模块),
然后在 repo_packages 或 repo_extra_packages 参数中指定下载 Docker 软件包。
这里指定的 docker(实际对应 docker-ce 与 docker-compose-plugin 两个软件包)会在默认的 deploy.yml 过程中自动下载到本地软件源中。
下载完成后的 Docker 软件包可以通过本地软件源,对所有节点可用。
如果您已经完成了 Pigsty 安装,本地软件源已经初始化完毕,您可以在修改配置之后执行 ./infra.yml -t repo_build 重新下载并构建离线软件源。
安装 Docker 需要用到 Docker 的 YUM/APT 仓库。该仓库在 v4.x 的默认 repo_upstream 中归属于 infra 模块,通常已经可用。
仓库
下载 Docker 需要用到互联网上游软件仓库,已定义在默认的 repo_upstream 中,模块名为 infra
您可以在 repo_modules 与 node_repo_modules 两个参数中,使用 infra 模块名引用这个仓库。
请注意,Docker 的官方软件仓库在中国大陆默认处于 封锁 状态,您需要使用中国地区的镜像站点才能正常完成下载。
如果您处在中国大陆地区遇到 Docker 本身下载失败的问题,请检查您的配置清单中,
region是否被设置为了default,默认情况下自动配置的region: china可以解决这个问题。
代理
如果您的网络环境需要使用代理服务器才能访问互联网,您可以在 Pigsty 的配置清单中配置 proxy_env 参数,这个参数会被写入到 Docker 的配置文件中的 proxy 相关配置中。
在执行 configure 的过程中如果指定了 -x 参数,当前环境中的代理服务器配置会自动生成到 Pigsty 配置文件到 proxy_env 中。
除了使用代理服务器之外,您还可以通过配置 Docker镜像站点 的方式来规避封锁。
镜像站
您可以通过参数 docker_registry_mirrors 指定 Docker 的 Registry Mirrors 参数,使用未被墙掉的镜像站点:
普通墙外用户,除了官方默认的 DockerHub 站点外,还可以考虑使用 quay.io 镜像站点。如果您的内网环境已经有了成熟的镜像基础设施,您可以使用内网的 Docker 镜像站点,避免受到外网镜像站点的影响,提高下载速度。
使用公有云厂商服务的用户可以考虑使用内网免费的 Docker 镜像。例如,如果您使用阿里云,可以使用阿里云提供的内网 Docker 镜像站点(需要登陆):
如果你使用腾讯云,可以使用腾讯云提供的内网 Docker 镜像站点(需要内网):
此外,您还可以使用 CF-Workers-docker.io 快速拉起您自己的 Docker 镜像代理。 也可以考虑使用免费的 Docker代理镜像 (风险自负!)
拉取镜像
参数 docker_image 与 docker_image_cache 可用于直接指定在 Docker 安装时,需要拉取的镜像列表。
使用这一功能,可以让 Docker 装好之后就带有指定的镜像(前提是可以成功拉取,此任务失败会自动忽略跳过)
例如,您可以在配置清单中指定需要拉取的镜像:
另一种预先加载镜像的方式是使用本地 save 的 tgz 压缩包:如果您预先使用 docker save xxx | gzip -c > /tmp/docker/xxx.tgz 将 Docker 镜像导出保存在本地。
那么这些导出的镜像文件可以通过参数 docker_image_cache 指定的 glob 被自动加载。默认的位置是: /tmp/docker/*.tgz。
这意味着你可以事先把镜像放在 /tmp/docker 目录中,然后执行 docker.yml 安装 docker 后会自动加载这些镜像包。
例如,在 supabase自建教程 中就使用了这种技术,在拉起 Supabase,安装 Docker 之前,把本地 /tmp/supabase 目录的 *.tgz 镜像压缩包都拷贝到了目标节点的 /tmp/docker 目录下。
应用
Pigsty 提供了一系列开箱即用的,基于 Docker Compose 的 软件模板,您可以用它们一键拉起使用外部由 Pigsty 管理数据库集群的业务软件。
2 - 参数列表
DOCKER 模块提供了 8 个配置参数。
参数概览
DOCKER 参数组用于 Docker 容器引擎的部署与配置,包括启用开关、数据目录、存储驱动、镜像加速以及监控。
| 参数 | 类型 | 级别 | 说明 |
|---|---|---|---|
docker_enabled | bool | G/C/I | 在当前节点上启用 Docker?默认不启用 |
docker_data | path | G/C/I | Docker 数据目录,默认为 /data/docker |
docker_storage_driver | enum | G/C/I | Docker 存储驱动,默认为 overlay2 |
docker_cgroups_driver | enum | G/C/I | Docker CGroup 文件系统驱动:cgroupfs,systemd |
docker_registry_mirrors | string[] | G/C/I | Docker 仓库镜像列表 |
docker_exporter_port | port | G | Docker 监控指标导出端口,默认为 9323 |
docker_image | string[] | G/C/I | Docker 待拉取的镜像列表,默认为空列表 |
docker_image_cache | path | G/C/I | Docker 待导入的镜像压缩包路径,默认为 /tmp/docker/*.tgz |
您可以使用 docker.yml 剧本,在节点上安装并启用 Docker。
Docker 的默认参数定义于 roles/docker/defaults/main.yml
docker_enabled
参数名称: docker_enabled, 类型: bool, 层次:G/C/I
是否在当前节点启用 Docker?默认为: false,即不启用。
docker_data
参数名称: docker_data, 类型: path, 层次:G/C/I
Docker 数据目录,默认为 /data/docker。
此目录用于存储 Docker 的镜像、容器、卷等数据。如果您有独立的数据磁盘,建议将此目录指向该磁盘的挂载点。
docker_storage_driver
参数名称: docker_storage_driver, 类型: enum, 层次:G/C/I
Docker 存储驱动,默认为 overlay2。
请参考官方文档:https://docs.docker.com/engine/storage/drivers/select-storage-driver/
可选的存储驱动包括:
overlay2:推荐的默认驱动,适用于大多数场景fuse-overlayfs:用于无 root 权限的容器场景btrfs:使用 Btrfs 文件系统时zfs:使用 ZFS 文件系统时vfs:用于测试目的,不推荐生产使用
docker_cgroups_driver
参数名称: docker_cgroups_driver, 类型: enum, 层次:G/C/I
Docker 使用的 CGroup FS 驱动,可以是 cgroupfs 或 systemd,默认值为: systemd
docker_registry_mirrors
参数名称: docker_registry_mirrors, 类型: string[], 层次:G/C/I
Docker 镜像仓库加速地址列表,默认值为:[] 空数组。
您可以使用 Docker 镜像站点加速镜像拉取,下面是一些中国大陆可用的镜像站点示例:
您也可以考虑使用 Cloudflare Worker 搭建 Docker Proxy 来加速访问。
如果拉取速度仍然太慢,您也可以考虑使用其他 Registry:docker login quay.io
docker_exporter_port
参数名称: docker_exporter_port, 类型: port, 层次:G
Docker 监控指标导出端口,默认为 9323。
Docker 守护进程会在此端口暴露 Prometheus 格式的监控指标,供监控基础设施采集。
docker_image
参数名称: docker_image, 类型: string[], 层次:G/C/I
Docker 待拉取的镜像列表,默认为空列表 []。
在这里指定的 Docker 镜像名称会在安装阶段自动拉取。
docker_image_cache
参数名称: docker_image_cache, 类型: path, 层次:G/C/I
本地 Docker 镜像离线缓存包 glob 匹配模式,默认为 /tmp/docker/*.tgz。
您可以使用 docker save | gzip 的方式将镜像打包,并通过此参数在 Docker 安装阶段自动导入。
匹配该模式的 .tgz 后缀 tarball 文件将使用以下方式逐个导入 Docker 中:
3 - 预置剧本
Docker 模块提供了一个默认的剧本 docker.yml,用于安装 Docker Daemon 与 Docker Compose。
docker.yml
剧本原始文件:docker.yml 中
执行本剧本,将会在带有 docker_enabled: true 标记的目标节点上安装 docker-ce 与 docker-compose-plugin,启用 dockerd 服务
以下是 docker.yml 剧本中可用的任务子集:
docker_install: 在节点上安装 Docker,Docker Compose 软件包docker_admin: 将指定的用户加入 Docker 管理员用户组中docker_dir: 创建 Docker 相关目录docker_config: 生成 Docker 守护进程服务配置文件docker_launch: 启动 Docker 守护进程服务docker_register: 将 Docker 守护进程注册为监控目标(别名标签:register/add_metrics)docker_image: 尝试从/tmp/docker/*.tgz加载预置镜像压缩包(如果存在)
Docker 模块没有提供专门的卸载剧本,如果您需要卸载 Docker,可以手工停止 docker 后卸载:
将 docker_enabled 改为 false 只会让 docker.yml 跳过整个 Docker 角色,不会停止或卸载已部署的 Docker,也不会删除 /data/docker。
上面的手工命令同样不会删除数据目录;Docker 的 VictoriaMetrics 文件发现目标可由 node-rm.yml 的 node_deregister 任务一并注销。
4 - 指标列表
本页快照记录 DOCKER 模块的 123 类监控指标;实际运行时的指标集合会随软件包版本、启用的采集器和目标状态变化。
| Metric Name | Type | Labels | Description |
|---|---|---|---|
| builder_builds_failed_total | counter | ip, cls, reason, ins, job, instance | Number of failed image builds |
| builder_builds_triggered_total | counter | ip, cls, ins, job, instance | Number of triggered image builds |
| docker_up | Unknown | ip, cls, ins, job, instance | N/A |
| engine_daemon_container_actions_seconds_bucket | Unknown | ip, cls, ins, job, instance, le, action | N/A |
| engine_daemon_container_actions_seconds_count | Unknown | ip, cls, ins, job, instance, action | N/A |
| engine_daemon_container_actions_seconds_sum | Unknown | ip, cls, ins, job, instance, action | N/A |
| engine_daemon_container_states_containers | gauge | ip, cls, ins, job, instance, state | The count of containers in various states |
| engine_daemon_engine_cpus_cpus | gauge | ip, cls, ins, job, instance | The number of cpus that the host system of the engine has |
| engine_daemon_engine_info | gauge | ip, cls, architecture, ins, job, instance, os_version, kernel, version, graphdriver, os, daemon_id, commit, os_type | The information related to the engine and the OS it is running on |
| engine_daemon_engine_memory_bytes | gauge | ip, cls, ins, job, instance | The number of bytes of memory that the host system of the engine has |
| engine_daemon_events_subscribers_total | gauge | ip, cls, ins, job, instance | The number of current subscribers to events |
| engine_daemon_events_total | counter | ip, cls, ins, job, instance | The number of events logged |
| engine_daemon_health_checks_failed_total | counter | ip, cls, ins, job, instance | The total number of failed health checks |
| engine_daemon_health_check_start_duration_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| engine_daemon_health_check_start_duration_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| engine_daemon_health_check_start_duration_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| engine_daemon_health_checks_total | counter | ip, cls, ins, job, instance | The total number of health checks |
| engine_daemon_host_info_functions_seconds_bucket | Unknown | ip, cls, ins, job, instance, le, function | N/A |
| engine_daemon_host_info_functions_seconds_count | Unknown | ip, cls, ins, job, instance, function | N/A |
| engine_daemon_host_info_functions_seconds_sum | Unknown | ip, cls, ins, job, instance, function | N/A |
| engine_daemon_image_actions_seconds_bucket | Unknown | ip, cls, ins, job, instance, le, action | N/A |
| engine_daemon_image_actions_seconds_count | Unknown | ip, cls, ins, job, instance, action | N/A |
| engine_daemon_image_actions_seconds_sum | Unknown | ip, cls, ins, job, instance, action | N/A |
| engine_daemon_network_actions_seconds_bucket | Unknown | ip, cls, ins, job, instance, le, action | N/A |
| engine_daemon_network_actions_seconds_count | Unknown | ip, cls, ins, job, instance, action | N/A |
| engine_daemon_network_actions_seconds_sum | Unknown | ip, cls, ins, job, instance, action | N/A |
| etcd_debugging_snap_save_marshalling_duration_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| etcd_debugging_snap_save_marshalling_duration_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_debugging_snap_save_marshalling_duration_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_debugging_snap_save_total_duration_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| etcd_debugging_snap_save_total_duration_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_debugging_snap_save_total_duration_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_disk_wal_fsync_duration_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| etcd_disk_wal_fsync_duration_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_disk_wal_fsync_duration_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_disk_wal_write_bytes_total | gauge | ip, cls, ins, job, instance | Total number of bytes written in WAL. |
| etcd_snap_db_fsync_duration_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| etcd_snap_db_fsync_duration_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_snap_db_fsync_duration_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_snap_db_save_total_duration_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| etcd_snap_db_save_total_duration_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_snap_db_save_total_duration_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_snap_fsync_duration_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| etcd_snap_fsync_duration_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| etcd_snap_fsync_duration_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| go_gc_duration_seconds | summary | ip, cls, ins, job, instance, quantile | A summary of the pause duration of garbage collection cycles. |
| go_gc_duration_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| go_gc_duration_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| go_goroutines | gauge | ip, cls, ins, job, instance | Number of goroutines that currently exist. |
| go_info | gauge | ip, cls, ins, job, version, instance | Information about the Go environment. |
| go_memstats_alloc_bytes | counter | ip, cls, ins, job, instance | Total number of bytes allocated, even if freed. |
| go_memstats_alloc_bytes_total | counter | ip, cls, ins, job, instance | Total number of bytes allocated, even if freed. |
| go_memstats_buck_hash_sys_bytes | gauge | ip, cls, ins, job, instance | Number of bytes used by the profiling bucket hash table. |
| go_memstats_frees_total | counter | ip, cls, ins, job, instance | Total number of frees. |
| go_memstats_gc_sys_bytes | gauge | ip, cls, ins, job, instance | Number of bytes used for garbage collection system metadata. |
| go_memstats_heap_alloc_bytes | gauge | ip, cls, ins, job, instance | Number of heap bytes allocated and still in use. |
| go_memstats_heap_idle_bytes | gauge | ip, cls, ins, job, instance | Number of heap bytes waiting to be used. |
| go_memstats_heap_inuse_bytes | gauge | ip, cls, ins, job, instance | Number of heap bytes that are in use. |
| go_memstats_heap_objects | gauge | ip, cls, ins, job, instance | Number of allocated objects. |
| go_memstats_heap_released_bytes | gauge | ip, cls, ins, job, instance | Number of heap bytes released to OS. |
| go_memstats_heap_sys_bytes | gauge | ip, cls, ins, job, instance | Number of heap bytes obtained from system. |
| go_memstats_last_gc_time_seconds | gauge | ip, cls, ins, job, instance | Number of seconds since 1970 of last garbage collection. |
| go_memstats_lookups_total | counter | ip, cls, ins, job, instance | Total number of pointer lookups. |
| go_memstats_mallocs_total | counter | ip, cls, ins, job, instance | Total number of mallocs. |
| go_memstats_mcache_inuse_bytes | gauge | ip, cls, ins, job, instance | Number of bytes in use by mcache structures. |
| go_memstats_mcache_sys_bytes | gauge | ip, cls, ins, job, instance | Number of bytes used for mcache structures obtained from system. |
| go_memstats_mspan_inuse_bytes | gauge | ip, cls, ins, job, instance | Number of bytes in use by mspan structures. |
| go_memstats_mspan_sys_bytes | gauge | ip, cls, ins, job, instance | Number of bytes used for mspan structures obtained from system. |
| go_memstats_next_gc_bytes | gauge | ip, cls, ins, job, instance | Number of heap bytes when next garbage collection will take place. |
| go_memstats_other_sys_bytes | gauge | ip, cls, ins, job, instance | Number of bytes used for other system allocations. |
| go_memstats_stack_inuse_bytes | gauge | ip, cls, ins, job, instance | Number of bytes in use by the stack allocator. |
| go_memstats_stack_sys_bytes | gauge | ip, cls, ins, job, instance | Number of bytes obtained from system for stack allocator. |
| go_memstats_sys_bytes | gauge | ip, cls, ins, job, instance | Number of bytes obtained from system. |
| go_threads | gauge | ip, cls, ins, job, instance | Number of OS threads created. |
| logger_log_entries_size_greater_than_buffer_total | counter | ip, cls, ins, job, instance | Number of log entries which are larger than the log buffer |
| logger_log_read_operations_failed_total | counter | ip, cls, ins, job, instance | Number of log reads from container stdio that failed |
| logger_log_write_operations_failed_total | counter | ip, cls, ins, job, instance | Number of log write operations that failed |
| process_cpu_seconds_total | counter | ip, cls, ins, job, instance | Total user and system CPU time spent in seconds. |
| process_max_fds | gauge | ip, cls, ins, job, instance | Maximum number of open file descriptors. |
| process_open_fds | gauge | ip, cls, ins, job, instance | Number of open file descriptors. |
| process_resident_memory_bytes | gauge | ip, cls, ins, job, instance | Resident memory size in bytes. |
| process_start_time_seconds | gauge | ip, cls, ins, job, instance | Start time of the process since unix epoch in seconds. |
| process_virtual_memory_bytes | gauge | ip, cls, ins, job, instance | Virtual memory size in bytes. |
| process_virtual_memory_max_bytes | gauge | ip, cls, ins, job, instance | Maximum amount of virtual memory available in bytes. |
| promhttp_metric_handler_requests_in_flight | gauge | ip, cls, ins, job, instance | Current number of scrapes being served. |
| promhttp_metric_handler_requests_total | counter | ip, cls, ins, job, instance, code | Total number of scrapes by HTTP status code. |
| scrape_duration_seconds | Unknown | ip, cls, ins, job, instance | N/A |
| scrape_samples_post_metric_relabeling | Unknown | ip, cls, ins, job, instance | N/A |
| scrape_samples_scraped | Unknown | ip, cls, ins, job, instance | N/A |
| scrape_series_added | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_dispatcher_scheduling_delay_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| swarm_dispatcher_scheduling_delay_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_dispatcher_scheduling_delay_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_manager_configs_total | gauge | ip, cls, ins, job, instance | The number of configs in the cluster object store |
| swarm_manager_leader | gauge | ip, cls, ins, job, instance | Indicates if this manager node is a leader |
| swarm_manager_networks_total | gauge | ip, cls, ins, job, instance | The number of networks in the cluster object store |
| swarm_manager_nodes | gauge | ip, cls, ins, job, instance, state | The number of nodes |
| swarm_manager_secrets_total | gauge | ip, cls, ins, job, instance | The number of secrets in the cluster object store |
| swarm_manager_services_total | gauge | ip, cls, ins, job, instance | The number of services in the cluster object store |
| swarm_manager_tasks_total | gauge | ip, cls, ins, job, instance, state | The number of tasks in the cluster object store |
| swarm_node_manager | gauge | ip, cls, ins, job, instance | Whether this node is a manager or not |
| swarm_raft_snapshot_latency_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| swarm_raft_snapshot_latency_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_raft_snapshot_latency_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_raft_transaction_latency_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| swarm_raft_transaction_latency_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_raft_transaction_latency_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_store_batch_latency_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| swarm_store_batch_latency_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_store_batch_latency_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_store_lookup_latency_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| swarm_store_lookup_latency_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_store_lookup_latency_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_store_memory_store_lock_duration_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| swarm_store_memory_store_lock_duration_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_store_memory_store_lock_duration_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_store_read_tx_latency_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| swarm_store_read_tx_latency_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_store_read_tx_latency_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_store_write_tx_latency_seconds_bucket | Unknown | ip, cls, ins, job, instance, le | N/A |
| swarm_store_write_tx_latency_seconds_count | Unknown | ip, cls, ins, job, instance | N/A |
| swarm_store_write_tx_latency_seconds_sum | Unknown | ip, cls, ins, job, instance | N/A |
| up | Unknown | ip, cls, ins, job, instance | N/A |
5 - 常见问题
谁能执行Docker命令?
默认情况下,Pigsty 会将当前远程节点执行剧本的管理用户(即目标节点上 ssh 远程登陆的用户),以及参数 node_admin_username 中指定的管理用户加入到 Docker 操作系统用户组中。
在这个用户组(docker)中的所有用户,可以使用 docker CLI 命令对 Docker 发起管理。
如果你想让其他用户也可以执行 Docker 命令,可以将该操作系统用户加入到 docker 组中:
使用代理服务器
在 Docker 安装过程中,如果 proxy_env 参数存在,
这里的 HTTP 代理服务器配置会被写入到 /etc/docker/daemon.json 配置文件中。
Docker 在从上游 Registry 拉取镜像时,会使用此代理服务器。
小提示,在执行 configure 过程中使用 -x 参数会将当前环境中的代理服务器配置写入到 proxy_env 中。
使用镜像站点
如果您在中国大陆网络环境下访问 DockerHub 较慢,可以优先考虑:
- 使用
docker_registry_mirrors配置可用镜像站点 - 或配置
proxy_env通过代理拉取镜像 - 也可直接使用其他公开 Registry(例如
quay.io)
将Docker纳入监控
在 Docker 模块安装过程中,针对节点单独执行监控目标注册子任务 docker_register(或别名标签 add_metrics)即可:
使用软件模板
Pigsty 提供了一系列使用 Docker Compose 拉起的软件 工具模板,可以开箱即用。
但需要首先安装 Docker 模块。