From 818811d82b51c5f83f1848a36857e9b7c898243c Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Fri, 6 Sep 2024 15:16:01 -0400 Subject: [PATCH] Update docker guide for home directory issues when local user doesn't match docker image user home directory. --- docs/docker-guide.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/docker-guide.md b/docs/docker-guide.md index 519b839a..ed1a8106 100644 --- a/docs/docker-guide.md +++ b/docs/docker-guide.md @@ -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 \ @@ -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 @@ -67,4 +70,4 @@ docker run --rm \ /home/weaver/target ``` -Notice in both cases, the docker image is mounting local directories as readonly. \ No newline at end of file +Notice in both cases, the docker image is mounting local directories as readonly.