Below is a simple step that verifies if docker exists validating existence of docker.service, if not it installs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| steps:
- script: |
if systemctl --all --type service | grep -Fq 'docker'; then
echo "docker.service exists"
else
sudo yum install --assumeyes docker
sudo usermod -a -G docker ec2-user
sudo systemctl enable docker.service
sudo systemctl start docker.service
sudo systemctl status docker.service --no-pager
docker version
echo "Docker Installed"
fi
displayName: Install docker
|