Windows 下安装使用docker swarm machine docker toolbox

假装没事ソ 提交于 2020-03-20 04:26:11

下载docker 集成安装环境

http://get.daocloud.io/#install-toolbox 这个网站很不错,下载

这个集成了 docker docker-machine ,还有git 环境

 

docker-machine 使用的官方网站在 http://docs.docker.com/machine/get-started/ 按照官方的一部一部的来

C:\Users\jackluo>sh
sh-3.1$ docker-machine create --driver virtualbox dev #创建机器
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: d:\Program Files\Docker Toolbox\docker-machine.exe env dev
sh-3.1$ env "$(docker-machine env dev)"
HOMEPATH=\Users\jackluo
APPDATA=C:\Users\jackluo\AppData\Roaming
PROGRAMW6432=C:\Program Files
TERM=cygwin
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
WINDIR=C:\Windows
COMMONPROGRAMW6432=C:\Program Files\Common Files
PUBLIC=C:\Users\Public
PROGRAMDATA=C:\ProgramData
USERDOMAIN=jackluo-PC
COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files
OS=Windows_NT
ALLUSERSPROFILE=C:\ProgramData
!::=::\
TEMP=/tmp
COMMONPROGRAMFILES=C:\Program Files (x86)\Common Files
USERNAME=jackluo
PROCESSOR_LEVEL=6
PATH=/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/d/Program Files/TortoiseSVN/bin:/d/Program Files/nodejs/:/d/Program Files/TortoiseGit/bin:/cmd:/bin:/d/Go/bin:/d/program files/skype/Phone/:/d/HashiCorp/Vagrant/bin:/c/W
tem32/WindowsPowerShell/v1.0/:.:/d/Program Files/Boot2Docker for Windows:/c/Users/jackluo/AppData/Roaming/npm:/d/golang/bin:/bin:.:/d/Program Files/Docker Toolbox
PSMODULEPATH=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
FP_NO_HOST_CHECK=NO
PWD=/c/Users/jackluo
SYSTEMDRIVE=C:
PROCESSOR_ARCHITEW6432=AMD64
USERPROFILE=C:\Users\jackluo
LOGONSERVER=\\JACKLUO-PC
PROCESSOR_ARCHITECTURE=x86
LOCALAPPDATA=C:\Users\jackluo\AppData\Local
!C:=C:\Users\jackluo
SHLVL=1
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
GOROOT=D:\Go\
HOMEDRIVE=C:
WINDOWS_TRACING_FLAGS=3
WINDOWS_TRACING_LOGFILE=C:\BVTBin\Tests\installpackage\csilogfile.log
VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
PROMPT=$P$G
COMSPEC=C:\Windows\system32\cmd.exe
TMP=/tmp
SYSTEMROOT=C:\Windows
PROCESSOR_REVISION=3a09
GOPATH=D:/golang;
PROGRAMFILES=C:\Program Files (x86)
NUMBER_OF_PROCESSORS=4
PROGRAMFILES(X86)=C:\Program Files (x86)
SESSIONNAME=Console
COMPUTERNAME=JACKLUO-PC
_=/bin/env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.103:2376"
export DOCKER_CERT_PATH="C:\Users\jackluo\.docker\machine\machines\dev"
export DOCKER_MACHINE_NAME="dev"
# Run this command to configure your shell:
# eval "$(d:\Program Files\Docker Toolbox\docker-machine.exe env dev)"
sh-3.1$ docker ps -a #可以执行命令了读取的就是如果报了

Get http://127.0.0.1:2375/v1.20/containers/json?all=1: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it..
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running? 

这个错,就是机器没有初始化好,先删除了,再慢慢等吧,创建

 

 

 

整个流程基本都是按照 http://docs.docker.com/swarm/install-manual/ 这个操作

sh-3.1$ docker run --rm swarm create
e6b07677f1fff45ebec4198ecbcb35f7
sh-3.1$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
sh-3.1$ docker run -d swarm join --addr=192.168.99.101:2376 token://e6b07677f1fff45ebec4198ecbcb35f
7
fd1fc6b456efd4df4e648b34ca301d8329052ff8c67dace2bf7fcf70be1db5c1
sh-3.1$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
fd1fc6b456ef        swarm               "/swarm join --addr=1"   4 seconds ago       Up 2 seconds        2375/tcp            lonely_lovelace
sh-3.1$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
sh-3.1$ docker run -d swarm join --addr=192.168.99.102:2376 token://4600de8f0e1340f4128ef072224cf7b
5
63b9f7f29dd99bb04d8a83c0d5c7dcae8ed41e3fe19cf5d11a7d7d5655e51b2e
sh-3.1$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
63b9f7f29dd9        swarm               "/swarm join --addr=1"   18 seconds ago      Up 16 seconds       2375/tcp            distracted_tesla
sh-3.1$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
63b9f7f29dd9        swarm               "/swarm join --addr=1"   4 minutes ago       Up 4 minutes        2375/tcp            distracted_tesla
sh-3.1$ docker -H tcp://0.0.0.0:2375 info
An error occurred trying to connect: Get https://0.0.0.0:2375/v1.20/info: dial tcp 0.0.0.0:2375: ConnectEx tcp: The requested address is not valid in its context.
sh-3.1$ docker -H tcp://0.0.0.0:2376 info
An error occurred trying to connect: Get https://0.0.0.0:2376/v1.20/info: dial tcp 0.0.0.0:2376: ConnectEx tcp: The requested address is not valid in its context.
sh-3.1$ docker -H tcp://192.168.99.101:2376 info
Containers: 2
Images: 8
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 12
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.0.9-boot2docker
Operating System: Boot2Docker 1.8.2 (TCL 6.4); master : aba6192 - Thu Sep 10 20:58:17 UTC 2015
CPUs: 1
Total Memory: 996.2 MiB
Name: swarm-master
ID: LLV3:7ZEK:GBAV:BJXY:ORLX:FRZF:3F5V:2QHP:PQG4:D3BZ:ZMEP:Z6CW
Debug mode (server): true
File Descriptors: 17
Goroutines: 25
System Time: 2015-10-13T04:39:20.353680777Z
EventsListeners: 0
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
 provider=virtualbox
sh-3.1$ docker -H tcp://192.168.99.101:2375 info
An error occurred trying to connect: Get https://192.168.99.101:2375/v1.20/info: dial tcp 192.168.99.101:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it.
sh-3.1$ docker -H tcp://192.168.99.101:2376 list
docker: 'list' is not a docker command.
See 'docker --help'.
sh-3.1$ docker -H tcp://192.168.99.101:2375 info
An error occurred trying to connect: Get https://192.168.99.101:2375/v1.20/info: tls: oversized record received with length 20527
sh-3.1$ docker -H tcp://192.168.99.101:2376 info
Containers: 2
Images: 8
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 12
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.0.9-boot2docker
Operating System: Boot2Docker 1.8.2 (TCL 6.4); master : aba6192 - Thu Sep 10 20:58:17 UTC 2015
CPUs: 1
Total Memory: 996.2 MiB
Name: swarm-master
ID: LLV3:7ZEK:GBAV:BJXY:ORLX:FRZF:3F5V:2QHP:PQG4:D3BZ:ZMEP:Z6CW
Debug mode (server): true
File Descriptors: 22
Goroutines: 33
System Time: 2015-10-13T05:30:10.041167884Z
EventsListeners: 0
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
 provider=virtualbox
sh-3.1$ docker -H tcp://192.168.99.102:2376 info
Containers: 1
Images: 8
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 10
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.0.9-boot2docker
Operating System: Boot2Docker 1.8.2 (TCL 6.4); master : aba6192 - Thu Sep 10 20:58:17 UTC 2015
CPUs: 1
Total Memory: 996.2 MiB
Name: swarm-agent-00
ID: J3GU:RXI6:TNZ4:CDYG:GP4X:J2F5:TGJE:7ZYB:O5UG:3XR4:4XV5:3WNT
Debug mode (server): true
File Descriptors: 17
Goroutines: 25
System Time: 2015-10-13T05:30:58.47227003Z
EventsListeners: 0
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
 provider=virtualbox
sh-3.1$

这个坑太多了,其次,就是太慢,还是等稳定版再试吧

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!