Невозможно отладить мой контейнер Docker с Visual Studio 2017

Я не могу отладить свой контейнер Docker в Visual Studio 2017.

Я использую Docker 18.06.1-ce и VS 15.8.8.

При запуске сеанса отладки в VS (control + F5) контейнер запускается нормально, но VS не подключен. Контейнер также продолжает работать и не запускается в dev Режим. Я должен использовать docker stop a76244870ffe если я хочу убить это.

Бег docker container ls :

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES
a76244870ffe        myapplication       "dotnet MyApplicat.."    25 minutes ago      Up 4 minutes        0.0.0.0:80->80/tcp   dockercompose10819768170563966978_myapplicatio_1

докер-compose.yml:

version: '3.4'

services:
  myapplication:
    image: ${DOCKER_REGISTRY}myapplication
    build:
      context: .
      dockerfile: dockerfile
    ports:
     - "80:80"
    environment:
     - ASPNETCORE_ENVIRONMENT=local

Построить вывод в VS:

1>------ Build started: Project: docker-compose, Configuration: Debug Any CPU ------
1>docker-compose  -f "C:\mylocation\docker-compose.yml" -p dockercompose10819768170563966978 --no-ansi config
1>The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
1>services:
1>  myapplication:
1>    build:
1>      context: C:\mylocation
1>      dockerfile: dockerfile
1>    environment:
1>      ASPNETCORE_ENVIRONMENT: local
1>    image: myapplication
1>    ports:
1>    - published: 80
1>      target: 80
1>version: '3.4'
1>docker-compose  -f "C:\mylocation\docker-compose.yml" -p dockercompose10819768170563966978 --no-ansi config
1>The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
1>services:
1>  myapplication:
1>    build:
1>      context: C:\mylocation
1>      dockerfile: dockerfile
1>    environment:
1>      ASPNETCORE_ENVIRONMENT: local
1>    image: myapplication
1>    ports:
1>    - published: 80
1>      target: 80
1>version: '3.4'
1>docker-compose  -f "C:\mylocation\docker-compose.yml" -p dockercompose10819768170563966978 --no-ansi config
1>The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
1>services:
1>  myapplication:
1>    build:
1>      context: C:\mylocation
1>      dockerfile: dockerfile
1>    environment:
1>      ASPNETCORE_ENVIRONMENT: local
1>    image: myapplication
1>    ports:
1>    - published: 80
1>      target: 80
1>version: '3.4'
1>docker-compose  -f "C:\mylocation\docker-compose.yml" -p dockercompose10819768170563966978 --no-ansi config
1>The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
1>services:
1>  myapplication:
1>    build:
1>      context: C:\mylocation
1>      dockerfile: dockerfile
1>    environment:
1>      ASPNETCORE_ENVIRONMENT: local
1>    image: myapplication
1>    ports:
1>    - published: 80
1>      target: 80
1>version: '3.4'
1>docker-compose  -f "C:\mylocation\docker-compose.yml" -p dockercompose10819768170563966978 --no-ansi up -d
1>The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
1>Starting dockercompose10819768170563966978_myapplication_1 ...
1>Starting dockercompose10819768170563966978_myapplication_1 ... done
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

dockerfile:

FROM microsoft/dotnet:2.1-sdk AS builder
WORKDIR /app
COPY ./src/myapplication/myapplication.csproj ./src/myapplication/myapplication.csproj
COPY nuget.config ./
WORKDIR ./src/myapplication/
RUN dotnet restore
WORKDIR /app
COPY ./src ./src
WORKDIR ./src/myapplication/
RUN dotnet publish myapplication.csproj -c Release -o publish
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS runner
WORKDIR /app
COPY --from=builder /app/src/myapplication/publish/ .
ENV ASPNETCORE_ENVIRONMENT local
EXPOSE 80
ENTRYPOINT ["dotnet", "MyApplication.dll"]

0 ответов

Ctrl + F5 - это ярлык для запуска без отладчика. Попробуйте F5 без Ctrl.

Установить Solution Configuration Отладить и нажать <CTRL + F5>построить свой docker image и запустить его локально.

Удар <F5> начать отладку.

Другие вопросы по тегам