如何指导计算引擎启动脚本在Docker容器中执行
我正在尝试在gcp计算引擎上运行启动脚本。 脚本启动,启动Docker容器,并从该容器中运行命令。 启动脚本之外,整个工作没有错误,但显然启动脚本不是为这个任务设计的?
我打电话。
gcloud compute instances create cloudml --image-family=container-vm --image-project=google-containers --boot-disk-size "40" --service-account "773889352370-compute@developer.gserviceaccount.com" --scopes "https://www.googleapis.com/auth/cloud-platform" --metadata-from-file startup-script=Training.sh
我可以通过串口监视启动脚本的日志。 我可以看到它正确抓住脚本,并开始。
第一个命令是docker run
sudo docker run -it --privileged -- gcr.io/api-project-773889352370/cloudmlengine
从日志中,它会拉动和提取
Jul 24 21:54:02 cloudml startupscript: latest: Pulling from api-project-773889352370/cloudmlengine Jul 24 21:54:02 cloudml startupscript: 9f0706ba7422: Pulling fs layer Jul 24 21:54:02 cloudml startupscript: ec542cd45f0c: Pulling fs layer Jul 24 21:54:02 cloudml startupscript: 07bcbd00d9b4: Pulling fs layer Jul 24 21:54:02 cloudml startupscript: acc6d9961302: Pulling fs layer Jul 24 21:54:02 cloudml startupscript: ef130a4b8961: Pulling fs layer Jul 24 21:54:02 cloudml startupscript: 5ecac320219d: Pulling fs layer Jul 24 21:54:02 cloudml startupscript: 54110f0dc661: Pulling fs layer
并最终
downloaded newer image for gcr.io/api-project-773889352370/cloudmlengine:latest
大。 该命令应该启动一个容器。 我希望脚本的其余部分从容器中运行。 从ssh这不是问题,码头运行 – 它给我带来了一个交互式的提示,但显然启动脚本不起作用。 下一个命令是
git clone https://github.com/bw4sz/DeepMeerkat.git
但整个事情有点儿没有一个明确的错误
Jul 24 21:59:53 [ 422.646195] IPv6: ADDRCONF(NETDEV_UP): veth8286626: link is not ready cloudml kernel: [ 422.639552] device veth8286626 entered promiscuous mode Jul 24 21:59:53 cloudml kernel: [ 422.646195] IPv6: ADDRCONF(NETDEV_UP): veth8286626: link is not ready [ 422.938314] IPv6: ADDRCONF(NETDEV_CHANGE): veth8286626: link becomes ready [ 422.945723] docker0: port 1(veth8286626) entered forwarding state [ 422.951977] docker0: port 1(veth8286626) entered forwarding state [ 422.962994] IPv6: ADDRCONF(NETDEV_CHANGE): docker0: link becomes ready Jul 24 21:59:53 cloudml kernel: [ 422.938314] IPv6: ADDRCONF(NETDEV_CHANGE): veth8286626: link becomes ready Jul 24 21:59:53 cloudml kernel: [ 422.945723] docker0: port 1(veth8286626) entered forwarding state Jul 24 21:59:53 cloudml kernel: [ 422.951977] docker0: port 1(veth8286626) entered forwarding state Jul 24 21:59:53 cloudml kernel: [ 422.962994] IPv6: ADDRCONF(NETDEV_CHANGE): docker0: link becomes ready [ 437.956027] docker0: port 1(veth8286626) entered forwarding state Jul 24 22:00:08 cloudml kernel: [ 437.956027] docker0: port 1(veth8286626) entered forwarding state Jul 24 22:00:29 cloudml sshd[3043]: Did not receive identification string from 139.162.75.112 Jul 24 22:02:26 cloudml sshd[3079]: Invalid user ftpuser from 128.199.72.218 Jul 24 22:02:26 cloudml sshd[3079]: input_userauth_request: invalid user ftpuser [preauth] Jul 24 22:02:26 cloudml sshd[3079]: Connection closed by 128.199.72.218 [preauth] Jul 24 22:06:07 cloudml sshd[3168]: Invalid user ftpuser1 from 128.199.72.218 Jul 24 22:06:07 cloudml sshd[3168]: input_userauth_request: invalid user ftpuser1 [preauth] Jul 24 22:06:07 cloudml sshd[3168]: Connection closed by 128.199.72.218 [preauth]
而且会持续一段时间。
我可以稍后ssh并尝试docker命令和下一个命令(git clone),它们运行没有问题,所以docker pull成功了,没有错误。
Ben@cloudml:~$ sudo docker run -it --privileged -- gcr.io/api-project-773889352370/cloudmlengine root@7d8ae18c2295:/# root@7d8ae18c2295:/# git clone https://github.com/bw4sz/DeepMeerkat.git Cloning into 'DeepMeerkat'... remote: Counting objects: 768, done. remote: Total 768 (delta 0), reused 0 (delta 0), pack-reused 768 Receiving objects: 100% (768/768), 41.38 MiB | 44.71 MiB/s, done. Resolving deltas: 100% (517/517), done. Checking connectivity... done. root@7d8ae18c2295:/#
我正在做这个错误的方式吗? 也许在这里,这只是一个工作,创建一个完整的kubernetes集群似乎是错误的。