I created a console application to run benchmark tests with the Benchmark.Net library. This application is packed into a Docker container, which is a part of the docker-compose scenario. The ENTRYPOINT
of that dockerfile
looks like this:
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Benchmarks.dll", "-f", "*"]
These args instruct the Benchmark.Net library to run all tests in that assembly.
The problem: the arguments are never passed to the console app. The docker-compose doesn't have command
or entrypoint
elements, it just references the dockerfile
. If I use CMD
in the combination with the ENTRYPOINT
, it doesn't have any effect:
ENTRYPOINT ["dotnet", "Benchmarks.dll"]
CMD [ "-f", "*" ]
I need to run it on CI, so the default args should always be passed.
What am I doing wrong? How to make it work?
UPDATE: If I run it with the pure docker run
command, it works just fine and gets the passed arguments. It turns out that when I run it from docker-compose
, it doesn't print anything. The service definition in docker-compose.yml
is quite simple, it just references the Dockerfile
:
benchmarks:
build:
context: ../
dockerfile: test/Benchmarks/Dockerfile
args:
- NUGET_SOURCE
depends_on:
- another.service
environment:
- ASPNETCORE_ENVIRONMENT=Development
volumes:
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
FINAL UPDATE: Unfortunately, I forgot to mention in my initial question that I run it from inside the Visual Studio with dscproj
. Apparently, VS adds its own rules about how to run the docker-compose project, overriding the command line.
There's still no proper solution for it, although there's an ugly workaround.
So, my question is a duplicate of this one. Case closed.