[英]how to go from development docker-compose.yml to deployed docker-compose.yml in aws
I have the following docker-compose.yml: 我有以下docker-compose.yml:
version: '3'
services:
server:
build:
context: ../../
dockerfile: ./packages/website/Dockerfile
command: yarn serve
environment:
PORT: 3000
NODE_ENV: production
restart: always
nginx:
build:
context: ./
dockerfile: ./nginx/Dockerfile
command: nginx -c /etc/nginx/nginx.conf -g "daemon off;"
depends_on:
- server
ports:
- "80:80"
restart: always
This works fantastically locally but now I want to deploy this to t2 micro or some other paid service but I don't know how I would go about it. 这在本地非常有效,但是现在我想将其部署到t2 micro或其他付费服务,但是我不知道该怎么做。
I think I would need to create a separate docker-compose.yml file which referenced images rather than physical Dockerfile(s) 我想我需要创建一个单独的docker-compose.yml文件,该文件引用图像而不是物理Dockerfile。
Can anyone shed any light on how I would go about this? 谁能阐明我该怎么做?
It's gonna work if you put the entire directory onto cloud (and keep the directory structure). 如果您将整个目录都放到云中(并保留目录结构),它将起作用。
If you somehow just want to upload the docker-compose.yml file to cloud without anything else, you need to modify it by removing the build
field and adding an image: xxx
field. 如果您只想将docker-compose.yml文件上传到云,而无需其他任何操作,则需要通过删除
build
字段并添加image: xxx
字段来对其进行修改。
The question now becomes "how can I refer to an image in my docker-compose.yml file`. 现在的问题变成“我如何在docker-compose.yml文件中引用图像”。
Two ways to achieve this: 实现此目的的两种方法:
registry-url/image-name:image-tag
. registry-url/image-name:image-tag
引用它。 If you're using DockerHub, you can ignore the registry-url/
part. registry-url/
部分。 scp
to the cloud. scp
到云。 And refer to it with image-name:image-tag
. image-name:image-tag
引用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.