gpt4 book ai didi

c# - Visual Studio 2019不会在项目打开时提取所需的Docker镜像

转载 作者:行者123 更新时间:2023-12-02 19:24:00 28 4
gpt4 key购买 nike

我觉得Visual Studio应该在项目启动时提取所有必需的Docker镜像。因此,我希望它下载并启动SQL Server和RabbitMQ镜像,因为它们是在我的docker compose中定义的:

version: '3.4'

services:

sql.data:
image: microsoft/mssql-server-linux:2017-latest

rabbitmq:
image: rabbitmq:3-management-alpine

projectname:
image: ${DOCKER_REGISTRY-}projectname
build:
context: .
dockerfile: ProjectName/Dockerfile
depends_on:
- sql.data
- rabbitmq

当Visual Studio打开我的项目时,我在 Container Tools窗口中看到以下内容:

========== Checking for Container Prerequisites ==========
Verifying that Docker Desktop is installed...
Docker Desktop is installed.
========== Verifying that Docker Desktop is running... ==========
Verifying that Docker Desktop is running...
Docker Desktop is running.
========== Verifying Docker OS ==========
Verifying that Docker Desktop's operating system mode matches the project's target operating system...
Docker Desktop's operating system mode matches the project's target operating system.
========== Pulling Required Images ==========
Checking for missing Docker images...
Docker images are ready.
========== Warming up container(s) for DataCollector ==========
Starting up container(s)...
docker run -dt -v ...
Container started successfully.
========== Finished ==========

在PowerShell中运行 docker ps -a时,我看到:
CONTAINER ID        IMAGE               COMMAND               CREATED             STATUS              PORTS                                           NAMES
a24958fbc70f projectname:dev "tail -f /dev/null" 13 minutes ago Up 13 minutes 0.0.0.0:56656->80/tcp, 0.0.0.0:44396->443/tcp intelligent_babbage

因此很明显,它没有拉(并启动)RabbitMQ和SQL Server容器。

我检查了 Tools > Options > Container Tools的设置,并将 Pull required Docker images on project open设置为 True

我不解为什么为什么不拉容器。

最佳答案

诀窍是将启动项目更改为DockerCompose

关于c# - Visual Studio 2019不会在项目打开时提取所需的Docker镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57741973/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com