Exercises to complete:# Run a pipeline in job in Jenkins Watch the status of docker Change the name of the image to see that it has to be correct according to the pattern explained in the video Fix the problem with not enough space on a logical volume VIDEO
1. Run the below pipeline in job in Jenkins# pipeline {
agent {
docker {
image 'alpine:latest'
label 'docker'
}
}
stages {
stage('Test') {
steps {
sh '''
cat /etc/os-release
pwd
cat /etc/passwd
sleep 60
'''
}
}
}
}
copy 2. Watch the status of the docker# 3. Change the name of the image to see that it has to be correct according to the pattern explained in the video.# Check which volume is almost full or full# list 10 biggest files in a var directory that is a volume with not enough space# 1
2
3
du -a /var | sort -n - r | head -n 10
# or with -h (human readable format)
du -h /var | sort -n - r | head -n 10
copy
Run docker prune command.# The Docker prune command automatically removes the resources not associated with a container. This is a quick way to get rid of old images, containers, volumes, and networks.
1
docker system prune -a -f
copy
Check the result after the cleanup# 1
du -hx --max-depth= 1 /var
copy
5. Resize the logical volume# 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# do the check
pvs
vgs
lvs
# extend the volume
lvextend -l +100%FREE /dev/docker-vg/var
# do the check
pvs
vgs
lvs
df -kTh /var
# resize the partition
resize2fs /dev/mapper/docker--vg-var
# do the chek
df -kTh /var
copy
6. Go back to Jenkins and rerun the job# 7. See the section of the tutorial to understand difference between docker images.# Understanding difference between Docker images. Node image contains nodejs and npm that allows node command to work.
Comments