github - 多个容器的自动构建

标签 github docker

我有几个预期会一起运行的容器。我是否需要为每个容器创建一个小型 github 存储库(看起来既浪费又不方便),或者我是否可以使用相同的 github 存储库作为自动构建多个容器的源?

最佳答案

如果希望容器一起运行,则使用 docker compose构建和运行它们。然后可以将与每个容器关联的 Docker 文件保存在子目录中。

例子

├── docker-compose.yml
├── one
│   └── Dockerfile
└── two
    └── Dockerfile

docker-compose.yml

web1:
  build: one
  ports:
    - 8080
web2:
  build: two
  ports:
    - 8080

关于github - 多个容器的自动构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33389517/

相关文章:

SVN与GIT并行

docker - “RUN sh -c '触摸/app.jar'”有什么作用?

docker - TensorFlow Serving 频繁请求超时

docker - Nexus 3 Docker容器和备份

github - Gitbash立即关闭,无法登录Github

github - Github 分支名称的最大长度是多少

heroku - 如何设置git远程heroku?

node.js - 从外部应用程序连接到Docker中的MongoDB

linux - 在 Docker 容器中运行的进程的主机中的 PID 是什么?

GitHub API : Fetch all folders and Files in Single GET Request