Skip to content

Commit c87f5dc

Browse files
authored
host-profiler: default UID/GID build args to workspace ids (#54353)
### What does this PR do? Provides default values for the `UID`/`GID` build args in the host-profiler dev `docker-compose.yml`, and documents them as optional in the README. ### Motivation `UID` and `GID` are shell variables that are not exported by default, so `${UID}`/`${GID}` expanded to empty strings unless the user explicitly exported them, breaking `docker compose build`. They now default to `2000:501`, the default user/group ids in Datadog workspaces. These also work on setups with uid-squashed mounts (colima/virtiofs), where the container uid is irrelevant. ### Describe how you validated your changes Manually built the host-profiler image with `docker compose build` without exporting `UID`/`GID`. ### Additional Notes Dev-tooling only change, no impact on shipped artifacts. Co-authored-by: nicolas.savoire <nicolas.savoire@datadoghq.com>
1 parent f398881 commit c87f5dc

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

cmd/host-profiler/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ Create a `.env` file in `cmd/host-profiler` containing:
6262

6363
```
6464
DD_SITE=datad0g.com # optional, defaults to "datadoghq.com"
65-
UID=1234 # required on Datadog workspace, set to the output of `id -u` on the workspace
66-
GID=1234 # required on Datadog workspace, set to the output of `id -g` on the workspace
65+
UID=2000 # optional, defaults to 2000; set to the output of `id -u` if your uid differs
66+
GID=501 # optional, defaults to 501; set to the output of `id -g` if your gid differs
6767
DD_TAGS="key:value,key1:value2" # optional, defaults to workspace:${workspace-name} on a Datadog workspace
6868
DD_HOSTPROFILER_DEBUG='{"verbosity":"detailed"}' # optional, enable debug exporter (basic|normal|detailed|none)
6969
DD_HOSTPROFILER_ADDITIONAL_HTTP_HEADERS='{"x-custom-header":"value"}' # optional, additional HTTP headers on OTLP exporter requests; defaults to workspace metadata on Datadog workspaces

cmd/host-profiler/docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ services:
2222
context: ../..
2323
dockerfile: tools/host-profiler/Dockerfile
2424
args:
25-
UID: ${UID}
26-
GID: ${GID}
25+
# default user/group ids in Datadog workspaces, also works for uid-squashed mounts (colima/virtiofs)
26+
UID: ${UID:-2000}
27+
GID: ${GID:-501}
2728
privileged: true
2829
pid: "host"
2930
cgroup: "host"

0 commit comments

Comments
 (0)