Skip to content

Commit

Permalink
docker is ok
Browse files Browse the repository at this point in the history
  • Loading branch information
liandeliang committed Jul 4, 2017
1 parent 762cfb9 commit ba64792
Showing 1 changed file with 21 additions and 42 deletions.
63 changes: 21 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,58 +31,37 @@ or: sudo sed -i "s|EXTRA_ARGS='|EXTRA_ARGS='--registry-mirror=https://k4qqsfsl.m

create hypver private network switcher: "Private".

PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" --hyperv-disk-size "2000" --hyperv-memory "512" local
PS C:\WINDOWS\system32> docker-machine stop local
add virtual network card on hypver-machine "local", bind network switcer: "Private". And change network card "Private", disable ipv6 checkbox option, change ipv4: 192.169.1.1 255.255.255.0. disable: Hypver-V Extensible Virtual Switch, Microsoft网络适配器多路传送器协议.
PS C:\WINDOWS\system32> docker-machine start local
PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" --hyperv-disk-size "2000" --hyperv-memory "512" --engine-registry-mirror "https://k4qqsfsl.mirror.aliyuncs.com" local

PS C:\WINDOWS\system32> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
local - hyperv Running tcp:https://[fe80::215:5dff:fe64:3e43]:2376 v17.03.2-ce
local - hyperv Running tcp:https://192.168.3.131:2376 v17.03.2-ce
PS C:\WINDOWS\system32> docker-machine ssh local
docker@local:~$ docker run -v /data:/data -d -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8400:8400 -p 8500:8500 -p 8600:8600 --name=consul consul agent -bootstrap -server -advertise 172.17.0.1 -datacenter local

PS C:\WINDOWS\system32> docker run swarm create
Unable to find image 'swarm:latest' locally
latest: Pulling from library/swarm
ebe0176dcf9a: Pull complete
19f771faa982: Pull complete
902eeedf931a: Pull complete
Digest: sha256:815fc8fd4617d866e1256999c2c0a55cc8f377f3dade26c3edde3f0543a70c04
Status: Downloaded newer image for swarm:latest
e0f9cec17f2f36404768fb50138d469d
the last line "e0f9cec17f2f36404768fb50138d469d" is swarm token.
docker@local:~$ docker run --restart=always -d -v /data:/data -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 8600:8600 consul agent -server -bootstrap-expect 2 -ui -client 0.0.0.0 -advertise 192.168.3.131 -node=local

PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" --hyperv-disk-size "3000" --hyperv-memory "1024" --swarm --swarm-master --swarm-discovery consul:https://172.17.0.1/swarm master1
PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" --hyperv-disk-size "3000" --hyperv-memory "1024" --swarm --swarm-discovery consul:https://172.17.0.1/swarm worker1
PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" --hyperv-disk-size "3000" --hyperv-memory "1024" --swarm --swarm-discovery consul:https://172.17.0.1/swarm worker2
PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" --hyperv-disk-size "3000" --hyperv-memory "1024" --swarm --swarm-master --swarm-discovery consul:https://192.168.3.131/swarm --engine-registry-mirror "https://k4qqsfsl.mirror.aliyuncs.com" master1
PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" --hyperv-disk-size "3000" --hyperv-memory "1024" --swarm --swarm-discovery consul:https://192.168.3.131/swarm --engine-registry-mirror "https://k4qqsfsl.mirror.aliyuncs.com" worker1
PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" --hyperv-disk-size "3000" --hyperv-memory "1024" --swarm --swarm-discovery consul:https://192.168.3.131/swarm --engine-registry-mirror "https://k4qqsfsl.mirror.aliyuncs.com" worker2

PS C:\WINDOWS\system32> docker-machine ssh master1
docker@master1:~$ docker run -v /data:/data -d -h master1 -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8400:8400 -p 8500:8500 -p 8600:53/udp --restart=always --name=consul consul -server -advertise 188.199.1.62 -join 188.199.1.89
or your can setup swarm mode from normal machine:
docker@master1:~$ docker run -d -p 4000:4000 swarm manage -H :4000 --replication --advertise 188.199.1.62:4000 consul:https://188.199.1.62:8500
4c5717a95711055a73b18d07b9a4c50fb076a24c1238c24fbba395b0da7ba004
docker@master1:~$ docker swarm init --advertise-addr 192.168.3.132
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-1lo5eozjzzci74e8ln2hlsgec0mhue265hatvddyrb2cls1hcv-2y2r7rpj05bgcn6zcr7mnw9aq 192.168.3.132:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
docker@master1:~$ docker run --restart=always -d -v /data:/data -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 8600:8600 consul agent -server -ui -client 0.0.0.0 -advertise 192.168.3.132 -node=master1 -join 192.168.3.131

PS C:\WINDOWS\system32> docker-machine ssh worker1
docker@worker1:~$ docker run -v /data:/data -d -h worker1 -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8400:8400 -p 8500:8500 -p 8600:53/udp --restart=always --name=consul consul -server -advertise 188.199.1.89 -join 188.199.1.89
or your can setup swarm mode from normal machine:
docker@worker1:~$ docker run -d -p 4000:4000 swarm manage -H :4000 --replication --advertise 188.199.1.89:4000 consul:https://188.199.1.89:8500
docker@worker1:~$ docker swarm join --token SWMTKN-1-5j8loljyo9dd88962q9w1olju2vamo3oysxx77lnssmdccmv2z-a2bmh1lcmn8vcnkdq71t1ngya 188.199.1.62:2377
docker@worker1:~$ docker swarm join --token SWMTKN-1-4zq9qr1zi9ip15jqtwp5k6quroupjmbp9c4ukymdipgjup24re-56ehxowuw1wd046bcodijg3ew 192.168.1.132:2377

docker@worker2:~$ docker run -v /data:/data -d -h worker2 -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8400:8400 -p 8500:8500 -p 8600:53/udp --restart=always --name=consul consul -server -advertise 188.199.1.54 -join 188.199.1.89
or your can setup swarm mode from normal machine:
docker@worker1:~$ docker run -d swarm join --token SWMTKN-1-5j8loljyo9dd88962q9w1olju2vamo3oysxx77lnssmdccmv2z-e54qpomvjk3wl6afy4r3ppnxx --advertise=188.199.1.54 consul:https://188.199.1.54:8500 188.199.1.62:2377


NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
local - hyperv Running tcp:https://188.199.1.89:2376 v17.05.0-ce
master1 - hyperv Running tcp:https://188.199.1.62:2376 master1 (master) v17.05.0-ce
worker1 - hyperv Running tcp:https://188.199.1.59:2376 master1 v17.05.0-ce
worker2 - hyperv Running tcp:https://188.199.1.54:2376 master1 v17.05.0-ce

download consul-template from: https://releases.hashicorp.com/consul-template/0.18.5/consul-template_0.18.5_windows_amd64.zip

unzip consul-template_0.7.0_linux_amd64.zip -d /usr/local/bin/
PS C:\WINDOWS\system32> docker-machine ssh worker2
docker@worker2:~$ docker swarm join --token SWMTKN-1-4zq9qr1zi9ip15jqtwp5k6quroupjmbp9c4ukymdipgjup24re-56ehxowuw1wd046bcodijg3ew 192.168.1.132:2377

PS C:\WINDOWS\system32> docker-machine env master1
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates
for host "192.168.3.132:2376": x509: certificate is valid for 192.168.3.100, not 192.168.3.132
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which might stop running containers.
PS C:\WINDOWS\system32> docker-machine regenerate-certs master1 -f

# how to build

Expand Down

0 comments on commit ba64792

Please sign in to comment.