Dockertools: Cannot change hosting environment while debugging

Created on 22 Jun 2018  Â·  4Comments  Â·  Source: microsoft/DockerTools

services:
  cache:
    image: redis:latest
  db:
    environment:
      POSTGRES_DB: webapi
      POSTGRES_USER: postgres
    image: postgres:10.4
    ports:
    - published: 5432
      target: 5432
    volumes:
    - pgdata:/var/lib/postgresql/data:rw
  webapi-core:
    build:
      context: /Users/sgourley/Projects/webapi-core
      dockerfile: api.mapserv.utah.gov/Dockerfile
      target: base
    entrypoint: tail -f /dev/null
    environment:
      ASPNETCORE_ENVIRONMENT: DockerDevelopment
      ASPNETCORE_URLS: http://+:1337
      DOTNET_USE_POLLING_FILE_WATCHER: '1'
      NUGET_FALLBACK_PACKAGES: /root/.nuget/fallbackpackages
    image: webapi:dev
    labels:
      com.microsoft.visualstudio.debuggee.arguments: ' --additionalProbingPath /root/.nuget/packages
        --additionalProbingPath /root/.nuget/fallbackpackages  bin/Debug/netcoreapp2.1/api.mapserv.utah.gov.dll'
      com.microsoft.visualstudio.debuggee.killprogram: /bin/bash -c "if PID=$$(pidof
        -x dotnet); then kill $$PID; fi"
      com.microsoft.visualstudio.debuggee.program: dotnet
      com.microsoft.visualstudio.debuggee.workingdirectory: /app
    links:
    - cache
    - db
    ports:
    - published: 1337
      target: 1337
    volumes:
    - /Users/sgourley/Projects/webapi-core/api.mapserv.utah.gov:/app:rw
    - /Users/sgourley/.vsdbg/vs2017u5:/remote_debugger:ro
    - /usr/local/share/dotnet/sdk/NuGetFallbackFolder:/root/.nuget/fallbackpackages:ro
    - /Users/sgourley/.nuget/packages:/root/.nuget/packages:ro
version: '3.6'
volumes:
  pgdata:
    external: true
    name: pgdata

hosting env is still Development

bug

All 4 comments

Thanks for reporting this, I managed to reproduce the issue in VS for Mac version 7.5.3 (build 7).
After doing some investigation, it seems that the way we start the debugger overrides the environment variable “ASPNETCORE_ENVIRONMENT” to “Development” although it gets set correctly in the container.

I’m working with the VS for Mac team to understand more on what’s causing that, in the mean time a workaround is to run the app without debugging and that will ensure the correct value being set.
I’ll keep you posted as soon as I have more updates on this.

any movement on this?

@steveoh apologies for the delayed response, this should be fixed in the latest 7.6 version. Please verify and let me know if you still face any issues.

i haven't tried but when or if I do, I'll come back here.

Was this page helpful?
0 / 5 - 0 ratings