Administration
Administration tasks for Docker
Install
To install & enable docker on nodes, configure 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):
./docker.yml -l infra
Docker will be installed on that infra
group.
infra is a placeholder
We are using the infra
group here as an example, you can define it elsewhere as long as it apply to expected hosts.
Repository
Docker repo is part of the infra
repo module, and will automatically add during repo build.
- name: docker-ce
description: 'Docker CE'
module: infra
releases: [7,8,9]
arch: [x86_64, aarch64]
baseurl:
default: 'https://download.docker.com/linux/centos/$releasever/$basearch/stable'
europe: 'https://mirrors.xtom.de/docker-ce/linux/centos/$releasever/$basearch/stable'
china: 'https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable'
- name: docker-ce
description: 'Docker CE'
module: infra
releases: [11,12,20,22,24]
arch: [x86_64, aarch64]
baseurl:
default: 'https://download.docker.com/linux/${distro_name} ${distro_codename} stable'
china: 'https://mirrors.aliyun.com/docker-ce/linux/${distro_name} ${distro_codename} stable'
You can add this repo to your nodes with:
./node.yml -t node_repo -e node_repo_modules=infra -l infra
Upgrade
To upgrade Docker Daemon, using the ansible
command, add docker repo, then:
ansible infra -m package -b -a 'name=docker-ce state=latest'
It will upgrade the docker-ce
package to the latest version available on your configured repositories.
Remove
To remove Docker Daemon, using the ansible
command to run:
ansible infra -m package -b -a 'name=docker-ce state=absent'
It will remove the docker-ce
package with your os package manager.
Applications
Pigsty provides ready-to-use software templates based on Docker Compose to deploy external applications seamlessly integrated with Pigsty-managed database clusters.