/
Jenkinsfile-master
53 lines (52 loc) · 1.68 KB
/
Jenkinsfile-master
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//Courtesy of Digital Ocean
//Borrowed from https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04
pipeline {
agent any
stages {
stage('Update the current packages') {
steps {
sh 'sudo apt update'
}
}
stage('Install prerequisite packages') {
steps {
sh 'sudo apt install -y apt-transport-https ca-certificates curl software-properties-common'
}
}
stage('Add the GPG key to verify the Docker download') {
steps {
sh 'curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -'
}
}
stage('Add the Docker repository to your local machine') {
steps {
sh 'sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"'
}
}
stage('Update the packages again from the newly added repo') {
steps {
sh 'sudo apt update'
}
}
stage('Point to the local Docker repo that you just created') {
steps {
sh 'apt-cache policy docker-ce'
}
}
stage('Finally, install Docker') {
steps {
sh 'sudo apt install -y docker-ce'
}
}
stage('Check that Docker is running on your remote workstation') {
steps {
sh 'sudo systemctl status docker'
}
}
stage('Add your user to the Docker group') {
steps {
sh 'sudo usermod -aG docker ${USER}'
}
}
}
}