-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-instructions
64 lines (44 loc) · 2.21 KB
/
docker-instructions
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
# Create Docker Machines
docker-machine create manager
docker-machine create worker1
docker-machine create worker2
docker-machine ssh manager
swarm init --advertise-addr=192.168.99.100
## Copy the swarm join command
docker swarm join --token SWMTKN-1-0p7hmpnatnqtexz9ewa4hcb4iost4u6sp578e177831d8ec6nl-34j14812r8wgdrzjps7rfdhdz 192.168.99.100:2377
docker-machine ssh worker1
paste
docker-machine ssh worker2
paste
eval $(docker-machine env manager)
# Create docker images
cd client
mvn package docker:build -Dmaven.test.skip=true
cd ../eureka
mvn package docker:build -Dmaven.test.skip=true
cd ../config
mvn package docker:build -Dmaven.test.skip=true
# Create network
docker network create --driver overlay network-us-west-2
# Create docker service
docker service create --replicas 2 --name config --reserve-memory=100Mb --publish 8888:8888 --update-delay 10s --network network-us-west-2 springio/config
docker service create --replicas 1 --name client --reserve-memory=100Mb --publish 8080:8080 --update-delay 10s --network network-us-west-2 springio/client
docker service create --replicas 1 --name eureka --reserve-memory=100Mb --publish 8761:8761 --update-delay 10s --network network-us-west-2 -e spring_application_name=eureka --constraint 'node.role == manager' springio/eureka
docker service create --replicas 1 --name eureka-backup --reserve-memory=100Mb --publish 8762:8762 --update-delay 10s --network network-us-west-2 -e spring_application_name=eureka-backup --constraint 'node.role != manager' springio/eureka
# Portener
docker service create \
--network network-us-west-2 \
--name portainer \
--publish 9000:9000 \
--constraint 'node.role == manager' \
--mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \
portainer/portainer \
-H unix:///var/run/docker.sock
# Docker update Service
## Update image
docker service update --image springio/client --force client
docker service update --image springio/eureka --force eureka
docker service update --image springio/eureka --force eureka-backup
## Update replicas
docker service update --replicas 2 client
docker service update --replicas 2 config