# Sample Docker Files

docker file

{% code overflow="wrap" lineNumbers="true" %}

```docker
FROM mcr.microsoft.com/dotnet/aspnet:6.0

# Sealights - copy agent, token and custom entry point
COPY --from=publish /tmp/sl-dotnet-agent /tmp/sl-dotnet-agent
COPY ["SeaLights/sltoken.txt", "/tmp/sl-dotnet-agent"]
COPY ["SeaLights/docker_entrypoint.sh", "/app/publish"]

WORKDIR /app
COPY --from=publish /app/publish .

ENTRYPOINT ["/app/docker_entrypoint.sh"]
```

{% endcode %}

entry point

{% code overflow="wrap" lineNumbers="true" %}

```sh
#!/bin/sh
echo Will start the app with Sealights
export SL_LogLevel='6'
export SL_LogDir='/tmp/sl_logs/'
dotnet /tmp/sl-dotnet-agent/SL.DotNet.dll run --instrumentationMode coverage --buildSessionIdFile /tmp/sl-dotnet-agent/buildSessionId.txt --target dotnet --workingDir /app --targetArgs "MyApp.dll" --logAppendFile true --logEnabled true --logFilename "/tmp/sl_logs/collector
```

{% endcode %}

## Alpine-based docker file for a self-contained app <a href="#alpine-based-docker-file-for-a-self-contained-app" id="alpine-based-docker-file-for-a-self-contained-app"></a>

{% code overflow="wrap" lineNumbers="true" %}

```docker
# https://mcr.microsoft.com/v2/dotnet/runtime-deps/tags/list
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0.3-alpine3.15-amd64
WORKDIR /
...

# Sealights - install prereq, agent, token, bsid
RUN mkdir -p /sealights/{agent,logs}
RUN wget -nv -O sealights-dotnet-agent-alpine.tar.gz https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-alpine-self-contained.tar.gz
RUN tar -xzf ./sealights-dotnet-agent-alpine.tar.gz --directory /sealights/agent
COPY ["SeaLights/sltoken.txt", "/sealights/"]
COPY ["SeaLights/buildSessionId.txt", "/sealights/"]
RUN chmod -R 777 /sealights

WORKDIR /app
COPY --from=builder /cartservice .
ENTRYPOINT ["/sealights/agent/SL.DotNet run --instrumentationMode coverage --buildSessionIdFile /sealights/buildSessionId.txt --tokenFile /sealights/sltoken.txt --workingDir /app --target /app/cartservice"]
```

{% endcode %}

{% hint style="info" %}
To enable SL logs, append to the ENTRYPOINT command the following parameters: `--profilerLogDir /sealights/logs --profilerLogLevel 6 --logAppendFile true --logEnabled true --logFilename /sealights/logs/collector`
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/.net-core-agent/capturing-coverage-from-the-application/sample-docker-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
