I have the following 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.
I think I would need to create a separate docker-compose.yml file which referenced images rather than physical Dockerfile(s)
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.
The question now becomes "how can I refer to an image in my docker-compose.yml file`.
Two ways to achieve this:
registry-url/image-name:image-tag
. If you're using DockerHub, you can ignore the registry-url/
part. scp
to the cloud. And refer to it with image-name:image-tag
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.