如何通过Visual Studio中的Docker Compose启动多个容器? [英] How to start several containers via Docker Compose in Visual Studio?

查看:190
本文介绍了如何通过Visual Studio中的Docker Compose启动多个容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个微服务项目:WebApi(C#,netcore,webapi)和前端(php + js)。前端使用Redis。所以我想在Visual Studio中调试WebApi时同时启动3个Docker容器(WebApi,Frontend,Redis)。有可能吗?


我添加了Docker和Docker业务流程支持。  Dockerfile    docker-compose.yml  文件出现了。我配置了docker-compose:


版本:'3.7'

网络:
esnet:

服务:
eswebapi:
图片:swebapi
build:
context:./ ESWebAPI
网络:
- esnet
公开:
- 80
端口:
- " 8080:80"
esweb:
image:esweb
build:
context:../../ app
networks:
- esnet
揭露:
- 80
端口:
- " 80:80"
esredis:
image:redis:3.2.12
公开:
- 6379
networks:
- esnet

我在Visual Studio中启动调试,但它只启动WebApi项目容器。前端和Redis根本没有启动。如何启动所有3个容器?<​​/ p>

我使用Visual Studio 2017社区版

解决方案


Hi Lans,



感谢您在此发帖。



这个论坛是关于使用visual studio(设计师,报告控件,编辑器等在vs ide中)。对于你的情况 这与asp.net核心更相关,请重定向此适当的论坛:  ASP。 NET
CORE论坛
  for更好的支持。





感谢您的理解。



最好的问候,



Dylan


I have two micro-service projects: WebApi (C#, netcore, webapi) and Frontend (php+js). Frontend uses Redis. So i want to start 3 Docker containers (WebApi, Frontend, Redis) simultaneously while debugging WebApi in Visual Studio. Is it possible?

I added Docker and Docker orchestration support. Dockerfile and docker-compose.yml files are appeared. I configured docker-compose:

version: '3.7'

networks:
  esnet:

services:
  eswebapi:
    image: swebapi
    build:
      context: ./ESWebAPI
    networks:
    - esnet
    expose:
    - 80
    ports:
    - "8080:80"    
  esweb:
    image: esweb
    build:
      context: ../../app
    networks:
    - esnet
    expose:
    - 80
    ports:
    - "80:80"      
  esredis:
    image: redis:3.2.12
    expose:
    - 6379
    networks:
    - esnet

I start debug in Visual Studio, but it starts only WebApi project container. Frontend and Redis aren't started at all. How to start all 3 containers?

I use Visual Studio 2017 Community Edition

解决方案

Hi Lans,

Thank you for posting here.

This forum is about using visual studio (designer ,reported controls, editor and etc in vs ide). For your case  which is more related to asp.net core, please redirect this appropriate forum: ASP.NET CORE forum for better support.

Thank you for your understanding.

Best Regards,

Dylan


这篇关于如何通过Visual Studio中的Docker Compose启动多个容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆