简体   繁体   English

使用Docker部署Web服务应用程序

[英]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.

相关问题 使用 docker 将 mule 应用程序部署到 mule 集群 - Deploying a mule application to a mule cluster using docker 将多容器Docker应用程序部署到Azure容器服务 - Deploying a multi-container docker application to Azure Container Service Docker:服务“web”无法构建(Django 应用程序) - Docker: Service 'web' failed to build (Django application) 使用docker部署Web应用程序(java Microservices)与在同一VM的多个端口中部署Web应用程序? - Deploying web apps(java Microservices) using docker vs deploying web apps in multiple ports in same VM? 在 azure 上使用 docker 映像部署 python web 应用程序 - Deploying python web app using docker image on azure 在Elastic Beanstalk上使用Docker部署.NET Core Web API - Deploying a .NET Core Web API using Docker on Elastic Beanstalk 使用 docker 构建 Node-js 生产环境并实时部署应用程序 - Node-js production build using docker and deploying application live 使用 caddy 服务器在 docker 中部署动态 Nextjs + Nodejs 应用程序 - Deploying dynamic Nextjs + Nodejs application inside docker using caddy server 使用 travis 将多容器 docker 应用程序部署到 heroku 时遇到问题 - Trouble deploying multi-container docker application to heroku using travis VC ++中的旧版Windows应用程序,已构建Docker Image。 使用Docker Service Create命令在Docker Swarm中部署应用程序时出现问题 - Legacy Windows application in VC++, Docker Image is built. Problem while deploying the application in Docker Swarm with Docker Service Create command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM