forked from RAHAMSHAIK007/dockernewproject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPROCESS
More file actions
128 lines (100 loc) · 2.52 KB
/
PROCESS
File metadata and controls
128 lines (100 loc) · 2.52 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
DOCKER PROJECT:
yum install docker -y
systemctl start docker
systemctl status docker
FROM ubuntu
RUN apt-get update -y
RUN apt-get install apache2 -y
COPY index.html /var/www/html/
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
DOCKER FILE : To create image by automation.
DOCKER COMPOSE : To create multiple containers on single server.
DOCKER SWARM : To create multiple containers on Multiple server.
DOCKE STACK : Docker swarm + Docker compose
1. CREATE 3 SERVERS AND INSTALL DOCKER ON ALL OF THEM & CREATE CLUSTER OF IT
yum install docker -y
systemctl start docker
systemctl status docker
docker swarm init --advertise-addr 172.31.85.110
docker node ls
2. INSTALLING JENKINS (MASTER)
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
amazon-linux-extras install java-openjdk11 -y
yum install git maven jenkins -y
systemctl start jenkins.service
systemctl status jenkins.service
3. CREATE CUSTOM IMAGES AND PUSH TO DOCKERHUB WITH TAGS
DOCKER FILE:
FROM ubuntu
RUN apt-get update -y
RUN apt-get install apache2 -y
COPY index.html /var/www/html/
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
INDEX.HTML:
PIPELINE:
pipeline {
agent any
stages {
stage('checkout') {
steps {
git 'https://github.com/RAHAMSHAIK007/dockernewproject.git'
}
}
stage('build') {
steps {
sh 'docker build -t $img .'
}
}
stage('tag') {
steps {
sh 'docker tag $img $repo'
}
}
stage('push') {
steps {
sh 'docker login -u -p '
sh 'docker push $repo'
}
}
}
}
4. GIVE PERMISSIONS
chmod 777 /var/run/docker.sock
systemctl daemon-reload
systemctl restart docker.service
5. WRITE COMPOSE FILE AND PUSH TO GITHUB
version: '3'
services:
devops:
image: rahamshaik/devopsreponit:latest
ports:
- "80:80"
volumes:
- "devopsvol"
deploy:
replicas: 3
aws:
image: rahamshaik/awsreponit:latest
ports:
- "81:80"
volumes:
- "awsvol"
deploy:
replicas: 3
datascience:
image: rahamshaik/datasciencereponit:latest
ports:
- "82:80"
volumes:
- "datasciencevol"
deploy:
replicas: 3
azure:
image: rahamshaik/azurereponit:latest
ports:
- "83:80"
volumes:
- "azurevol"
deploy:
replicas: 3