PIGSTY

Configure

Configure your docker setup

Pigsty includes built-in Docker support, allowing you to quickly deploy containerized applications.


Quick Start

To install docker on nodes, set the docker_enabled parameter to true.

all:
  vars:

    infra:
      hosts:
        10.10.10.10: { infra_seq: 1, nodename: infra-1 }
        10.10.10.11: { infra_seq: 2, nodename: infra-2 }
      vars:
        docker_enabled: true  # Install Docker on this group

Then run the docker.yml playbook (on target hosts/groups):

~/pigsty
./docker.yml -l infra

Docker will be installed on that infra group.


Registry

You can specify docker registry mirrors with docker_registry_mirrors:

all:
  vars:
    docker_registry_mirrors: ["https://docker.1ms.run"]

Here are some example registry mirrors:

  • Alibaba Cloud: ["https://registry.cn-hangzhou.aliyuncs.com"]
  • Tencent Cloud: ["https://ccr.ccs.tencentyun.com"]
  • DaoCloud: ["https://docker.m.daocloud.io"]
  • 1Ms: ["https://docker.1ms.run"]

You can specify multiple registry mirrors as an array, remember to quote the URL with ".


Proxy

Docker will use the proxy_env parameter if specified.

You can define it on global parameters all.vars or dedicate groups (such as infra ):

all:
  vars:
    proxy_env:
      no_proxy: "localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16,*.pigsty,*.aliyun.com,mirrors.*"
      http_proxy: 'http://127.0.0.1:12345'
      https_proxy: 'http://127.0.0.1:12345'
      all_proxy: 'http://127.0.0.1:12345'

It will be rendered to /etc/docker/daemon.json during the docker_config task:

{
  "proxies": {
    "http-proxy": "127.0.0.1:12345",
    "https-proxy": "127.0.0.1:12345",
    "no-proxy": "localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16,*.pigsty,*.aliyun.com,mirrors.*,*.tsinghua.edu.cn"
  }
}

This is useful if direct network access is blocked due to various reasons.


Images

You can provision docker images with docker_image and docker_image_cache:

infra:
  hosts:
    10.10.10.10: { infra_seq: 1 }
  vars:
    docker_enabled: true
    docker_image:
      - redis:latest
    docker_image_cache: "/tmp/docker/*.tgz"

The images defined in docker_image will be pulled during the docker_image task, one by one. And the local docker image cache with .tgz suffix matching the docker_image_cache glob list will be loaded into docker with docker load


Accelerate

You can use accelerators on each cloud vendors: