[英]Deploying web service application using Docker
I'm using Docker to deploy my web service to GCE and I'm following the instructions given here: https://blog.golang.org/docker 我正在使用Docker将我的Web服务部署到GCE,并且按照此处给出的说明进行操作: https : //blog.golang.org/docker
I have created a private repository on Bitbucket, made an automated build and I'm able to run my build with "docker run namespace/repo" remembering to run "docker login" beforehand (!). 我已经在Bitbucket上创建了一个私有存储库,进行了自动构建,并且能够记住“预先运行docker登录”(“!”)来运行“ docker run namespace / repo”构建。
Now, creating the GCE instance succeeds without errors, but my image is not running (using "sudo docker ps") 现在,成功创建GCE实例而没有错误,但是我的映像未运行(使用“ sudo docker ps”)
How can I setup the containers.yaml to install private Docker images? 如何设置container.yaml以安装私有Docker映像?
Below is my containers.yaml file: 以下是我的container.yaml文件:
version: v1beta2
containers:
- name: my-webservice
image: namespace/repo:latest
ports:
- name: http
hostPort: 80
containerPort: 8080
Unfortunately, I don't see anything in the manifest that would let you specify the login credentials in the manifest spec , but there might be a way to workaround it. 不幸的是,我在清单中看不到任何可以让您在清单规范中指定登录凭据的东西,但是可能有一种解决方法。
You can run startup scripts, so try to create one with 您可以运行启动脚本,因此请尝试使用
#!/bin/sh
docker login -u your_user -p yourpassword
Then add the startup script to your instance with 然后使用以下命令将启动脚本添加到您的实例中
gcloud compute instances add-metadata yourvmname \
--metadata-from-file startup-script=yourshellscript.sh
That should run that script before docker starts and have you logged in when it pulls the images. 那应该在docker启动之前运行该脚本,并在拉取图像时让您登录。
If that doesn't work, there is a method to load docker images from your cloud storage bucket called docker-registry-driver-gcs. 如果这不起作用,则有一种名为docker-registry-driver-gcs的方法可从您的云存储桶中加载docker映像。 You can see the example here . 您可以在此处查看示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.