Usage: docker-machine-Windows-x86_64.exe [OPTIONS] COMMAND [arg...] Options: --debug, -D Enable debug mode --storage-path, -s "C:\Users\WeiyiGeek\.docker\machine" Configures storage path [$MACHINE_STORAGE_PATH] --tls-ca-cert CA to verify remotes against [$MACHINE_TLS_CA_CERT] --tls-ca-key Private key to generate certificates [$MACHINE_TLS_CA_KEY] --tls-client-cert Client cert to use for TLS [$MACHINE_TLS_CLIENT_CERT] --tls-client-key Private key used in client TLS auth [$MACHINE_TLS_CLIENT_KEY] --github-api-token Token to use for requests to the Github API [$MACHINE_GITHUB_API_TOKEN] --native-ssh Use the native (Go-based) SSH implementation. [$MACHINE_NATIVE_SSH] --bugsnag-api-token BugSnag API token for crash reporting [$MACHINE_BUGSNAG_API_TOKEN] --help, -h show help --version, -v print the version
Docker Desktop for Mac - virtualbox driver Docker Desktop for Windows - hyperv driver
(3) 构建镜像时候由于拉取Github的releases速度较慢会导致下载失败提示
1 2 3 4 5 6 7 8 9 10 11 12 13
# 错误信息 (worker-01) Latest release for github.com/boot2docker/boot2docker is v19.03.12 (worker-01) Downloading C:\Users\WeiyiGeek\.docker\machine\cache\boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v19.03.12/boot2docker.iso... worker-01) 0%Error removing file: Error removing temporary download file: remove C:\Users\WeiyiGeek\.docker\machine\cache\boot2docker.iso.tmp850714895: The process cannot access the file because it is being used by another process. (worker-01) Error with pre-create check: "read tcp 10.20.172.103:57715->52.216.89.11:443: wsarecv: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."
docker@worker-01:~$ docker swarm init --advertise-addr 10.20.172.122 # docker swarm join --token SWMTKN-1-0w8bvf8gzw5hct845izbv38qvl45385r19p4gwo0v8fuwie68g-603ibqyz4od3mmnw1gmbahd8v 10.10.107.245:2377 # To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
Step2.将worker-01/worker-02加入到swarm集群之中
1 2 3 4 5 6 7 8 9
# worker-01 节点 PS F:\ChoromeDownload>.\docker-machine.exe ssh worker-01 docker@worker-01:~$ docker swarm join --token SWMTKN-1-0w8bvf8gzw5hct845izbv38qvl45385r19p4gwo0v8fuwie68g-603ibqyz4od3mmnw1gmbahd8v 10.10.107.245:2377 This node joined a swarm as a worker.
# worker-02 节点 PS F:\ChoromeDownload> .\docker-machine.exe ssh worker-02 [root@node2 ~]$ docker swarm join --token SWMTKN-1-0w8bvf8gzw5hct845izbv38qvl45385r19p4gwo0v8fuwie68g-603ibqyz4od3mmnw1gmbahd8v 10.10.107.245:2377 This node joined a swarm as a worker.
Step 3.在Swarm控制节点上查看加入的节点:
1 2 3 4 5
$ docker node ls # ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION # tqulwewuzrgayabjomy3xw55u * node2 Ready Active Leader(领导者) 19.03.12 # 7vp6qrabwp7ee2dkq0d1bf11l worker-01 Ready Active 19.03.12 # kxhd5fdxvarn6vpjweadf8yfb worker-02 Ready Active 19.03.12
# 节点退出集群 docker@worker-02:~$ docker swarm leave Node left the swarm.
# 查看节点 docker@master-01:~$ docker node ls ID HOSTNAME STATUS AVAILABILITY(可用性) MANAGER STATUS ENGINE VERSION j5auh1zg6qzvmzkf80wvpl9hr worker-02 Down 状态 Drain 已停止 19.03.12 tjwo77l1i08gzextmfwn69i9z * worker-01 Ready Active Leader 19.03.12
# 控制节点退出swarm集群 docker@master-01:~$ docker swarm leave --force Node left the swarm.
0x03 在Docker中运行Docker(dind)
(1) dind 介绍
描述: 什么是dind(Docker in Docker)? 答: 就是在Docker容器内启动docker daemon从而对外提供服务, 每个运行容器都是在一个进程它托管在Docker Daemon。
# todo ENV DOCKER_SHA256 # https://github.com/docker/docker-ce/blob/5b073ee2cf564edee5adca05eee574142f7627bb/components/packaging/static/hash_files !! # (no SHA file artifacts on download.docker.com yet as of 2017-06-07 though)
RUN set -eux; \ \ # this "case" statement is generated via "update.sh" apkArch="$(apk --print-arch)"; \ case"$apkArch"in \ # amd64 x86_64) dockerArch='x86_64' ;; \ # arm32v6 armhf) dockerArch='armel' ;; \ # arm32v7 armv7) dockerArch='armhf' ;; \ # arm64v8 aarch64) dockerArch='aarch64' ;; \ *) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;;\ esac; \ \ if ! wget -O docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/${dockerArch}/docker-${DOCKER_VERSION}.tgz"; then \ echo >&2 "error: failed to download 'docker-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${dockerArch}'"; \ exit 1; \ fi; \ \ tar --extract \ --file docker.tgz \ --strip-components 1 \ --directory /usr/local/bin/ \ ; \ rm docker.tgz; \ \ dockerd --version; \ docker --version
# https://github.com/docker-library/docker/pull/166 # dockerd-entrypoint.sh uses DOCKER_TLS_CERTDIR for auto-generating TLS certificates # docker-entrypoint.sh uses DOCKER_TLS_CERTDIR for auto-setting DOCKER_TLS_VERIFY and DOCKER_CERT_PATH # (For this to work, at least the "client" subdirectory of this path needs to be shared between the client and server containers via a volume, "docker cp", or other means of data sharing.)
ENV DOCKER_TLS_CERTDIR=/certs # also, ensure the directory pre-exists and has wide enough permissions for "dockerd-entrypoint.sh" to create subdirectories, even when run in "rootless" mode RUN mkdir /certs /certs/client && chmod 1777 /certs /certs/client # (doing both /certs and /certs/client so that if Docker does a "copy-up" into a volume defined on /certs/client, it will "do the right thing" by default in a way that still works for rootless users)
# first arg is `-f` or `--some-option` if [ "${1#-}" != "$1" ]; then set -- docker "$@" fi
# if our command is a valid Docker subcommand, let's invoke it through Docker instead # (this allows for "docker run docker ps", etc) if docker help"$1" > /dev/null 2>&1; then set -- docker "$@" fi
# if we have no DOCKER_HOST but we do have the default Unix socket (standard or rootless), use it explicitly if [ -z "${DOCKER_HOST:-}" ] && [ -S /var/run/docker.sock ]; then export DOCKER_HOST=unix:///var/run/docker.sock elif [ -z "${DOCKER_HOST:-}" ] && XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" && [ -S "$XDG_RUNTIME_DIR/docker.sock" ]; then export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/docker.sock" fi
# if DOCKER_HOST isn't set (no custom setting, no default socket), let's set it to a sane remote value if [ -z "${DOCKER_HOST:-}" ]; then if _should_tls || [ -n "${DOCKER_TLS_VERIFY:-}" ]; then export DOCKER_HOST='tcp://docker:2376' else export DOCKER_HOST='tcp://docker:2375' fi fi
if [ "${DOCKER_HOST#tcp:}" != "$DOCKER_HOST" ] \ && [ -z "${DOCKER_TLS_VERIFY:-}" ] \ && [ -z "${DOCKER_CERT_PATH:-}" ] \ && _should_tls \ ; then export DOCKER_TLS_VERIFY=1 export DOCKER_CERT_PATH="$DOCKER_TLS_CERTDIR/client" fi
if [ "$1" = 'dockerd' ]; then cat >&2 <<-'EOW' 📎 Hey there! It looks like you're trying to run a Docker daemon. You probably should use the "dind" image variant instead, something like: docker run --privileged --name some-docker ... docker:dind ... See https://hub.docker.com/_/docker/ for more documentation and usage examples. EOW sleep 3 fi exec "$@"
方式1.请访问本博主的B站【WeiyiGeek】首页关注UP主, 将自动随机获取解锁验证码。
Method 2.Please visit 【My Twitter】. There is an article verification code in the homepage.
方式3.扫一扫下方二维码,关注本站官方公众号
回复:验证码
将获取解锁(有效期7天)本站所有技术文章哟!