简体   繁体   中英

Visual Studio 2019 does not pull required Docker images at project open

I am under the impression that Visual Studio should pull all the required Docker images at project startup; hence, I expect it download and start SQL Server and RabbitMQ images since they are defined in my 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

I see the following in Container Tools window when visual studio opens my project:

========== 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 ==========

When I run docker ps -a in PowerShell, I see:

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

So obviously it has not pulled (and started) the RabbitMQ and SQL Server containers.

I checked the settings at Tools > Options > Container Tools and Pull required Docker images on project open is set to True .

I am puzzled why the containers are not pulled then.

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM