Skip to content

Commit

Permalink
Update docker guide for home directory issues when local user doesn't…
Browse files Browse the repository at this point in the history
… match docker image user home directory. (#356)

Co-authored-by: Laurent Quérel <[email protected]>
  • Loading branch information
jsuereth and lquerel authored Sep 9, 2024
1 parent cdea78f commit b1af4cf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/docker-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ When generating code against the latest OpenTelemetry semantic conventions, we r
```sh
docker run --rm \
-u $(id -u ${USER}):$(id -g ${USER}) \
--env HOME=/tmp/weaver \
--mount 'type=bind,source=$(HOME)/.weaver,target=/tmp/weaver/.weaver' \
--mount 'type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \
--mount 'type=bind,source=$(PWD)/src,target=/home/weaver/target' \
otel/weaver:latest \
Expand All @@ -22,11 +24,12 @@ docker run --rm \
/home/weaver/target
```

This has three key components:
This has four key components:

- Using your local user as the docker container user (`-u $(id -u ${USER}):$(id -g ${USER})`)
- Binding your local codegen templates as readonly (`--mount 'type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly'`)
- Binding the directory where code will be generated to the `/home/weaver/target` directory in the container: (` --mount 'type=bind,source=$(PWD)/src,target=/home/weaver/target'`)
- Granting weaver usage of your `~/.weaver` directory: (`--env HOME=/tmp/weaver --mount 'type=bind,source=$(HOME)/.weaver,target=/tmp/weaver/.weaver'`)

## Advanced Usage - Interactive Shell

Expand Down Expand Up @@ -67,4 +70,4 @@ docker run --rm \
/home/weaver/target
```

Notice in both cases, the docker image is mounting local directories as readonly.
Notice in both cases, the docker image is mounting local directories as readonly.

0 comments on commit b1af4cf

Please sign in to comment.