Docker-Compose,如何创建一个包括后端应用程序+数据库/
我是Docker-Compose的新手,我想创建我最近构建的应用程序的图像。
我唯一的问题是,当我运行docker-compose
在本地起作用时(即Docker从Docker Hub中摘下Mariadb图像并相应地构建我的后端),我可以通过我的后端访问它浏览器和bla bla。
现在是时候在Azure上部署该应用程序了,我注意到它没有构建预构建的Mariadb
图像。它仅构建后端应用程序,导致部署故障。
docker-compose.yml
version: '3.2'
services:
db:
container_name: test-db
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: saicom
ports:
- 3306:3306
networks:
- app-network
be:
container_name: test-be
build:
context: .
dockerfile: 'Dockerfile'
ports:
- '8080:4200'
depends_on:
- "db"
networks:
- app-network
networks:
app-network:
driver: bridge
我试图评论docker-compose.yml文件中的服务 它给了这个
我不确定为什么Docker-Compose会跳过Mariadb图像而不将其包含在我的应用中。
我需要一个好的撒玛利亚人来向我解释我的构建有什么问题。
提前致谢
I'm fairly new to docker-compose and I wanted to create an image of an application that I've built recently.
The only issue that I'm having is that when I run docker-compose up
locally it works (i.e docker pulled both the MariaDB image from docker hub and built my backend accordingly) I can access it via my browser and bla bla.
Now comes the time to deploy the app on azure and I noticed that it's not building the prebuilt MariaDB
image. It is only building the backend app causing deployment failure.
docker-compose.yml
version: '3.2'
services:
db:
container_name: test-db
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: saicom
ports:
- 3306:3306
networks:
- app-network
be:
container_name: test-be
build:
context: .
dockerfile: 'Dockerfile'
ports:
- '8080:4200'
depends_on:
- "db"
networks:
- app-network
networks:
app-network:
driver: bridge
I tried to comment the be service in the docker-compose.yml file
and it is giving this
I'm not sure why docker-compose is skipping the MariaDB image and not including it in my app.
I need a good samaritan to explain me what's wrong with my build.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论