Docker arguments not passing to .NET app when running or debugging with Rider
Im trying to pass arguments from Rider’s Docker run configuration and tie them back into Program.cs (like migrate, apietc). However, arguments are not being passed when Rider is running or in debug mode. However, it works fine when running command docker compose -f docker-compose.yml -f docker-compose.override.yml --profile migrate upfrom terminal.
Below is my setup:
docker-compose.ymlservices: postgres: image: postgres:16-alpine container_name: pfm_db restart: always volumes: - pg_data:/var/lib/postgresql/data ports: - "5433:5432" environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - POSTGRES_DB=local_db networks: - pfm_network migration-job: container_name: migration-job build: context: . dockerfile: src/API/Dockerfile depends_on: - postgres command: [ "migrate" ] networks: - pfm_network api: container_name: pfm_api ports: - "5000:80" - "5001:443" depends_on: - localstack build: context: . dockerfile: src/API/Dockerfile command: [ "api" ] networks: - pfm_network
docker-compose.override.ymlversion: ‘3.4’services: api: profiles: ["api"] environment: - ASPNETCORE_ENVIRONMENT= Development - ASPNETCORE_URLS=http://+:80 ports: - "5000:80" - "5001:443" volumes: - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro migration-job: profiles: [ "migrate" ] environment: - ASPNETCORE_ENVIRONMENT= Development
Docker Launch Settings

Please sign in to leave a comment.
Hello Shehi,
Thank you for contacting JetBrains Support. I'm glad to work with you on this ticket.
Regarding “arguments not passing", do you mean the environment variable “ASPNETCORE_ENVIRONMENT” of “migrate” profile in this case? I've tried the same setup in my environment, but unable to reproduce the issue.
Please try to disable docker fast mode:
If the issue persists, is it possible to share a minimized project that can reproduce the issue? You can upload it to the Upload Service and share the Upload ID.
Thanks,
Tom
Apologies for the late reply. Im referring to
command: [ "api" ]. I expect"api"to be passed as a command-line argument to my .NET application’s entrypoint and access it inProgram.cslikevar mode = args.FirstOrDefault()?.ToLowerInvariant();. However, this is not the case when I run the app in debug mode. It works fine when using environment variables likeASPNETCORE_ENVIRONMENTHello Shehi,
Sorry for the delayed response, and thanks for the additional details. The issue is likely caused by Docker Fast Mode in Rider, which would modify the entrypoint. Could you please disable fast mode as mentioned in my previous reply? Please let me know if the issue persists.
Thanks,
Tom