File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
github-tests/Dockerfile/docker-from-docker-non-root/.devcontainer Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -764,6 +764,13 @@ jobs:
764764 (cd common && npm install && npm run build)
765765 (cd github-action/ && npm install && npm run build && npm run package)
766766
767+ - name : UID INFO
768+ run : echo 'UID INFO'; id; ls -l /var/run/docker.sock
769+
770+ - name : Set DOCKER_GID
771+ run : |
772+ echo "DOCKER_GID=$(getent group docker | cut -d: -f3)" >> $GITHUB_ENV
773+
767774 - name : Run test
768775 uses : ./
769776 with :
@@ -775,6 +782,8 @@ jobs:
775782 eventFilterForPush : |
776783 push
777784 pull_request
785+ env :
786+ DOCKER_GID : ${{ env.DOCKER_GID }}
778787
779788 test-gh-docker-from-docker-root :
780789 name : Run GitHub docker-from-docker-root test
Original file line number Diff line number Diff line change @@ -52,7 +52,13 @@ COPY scripts/docker-client.sh /tmp/
5252RUN /tmp/docker-client.sh
5353
5454# Add user to docker group
55- RUN sudo groupadd docker && sudo usermod -aG docker $USERNAME && newgrp docker
55+ ARG DOCKER_GID=
56+ RUN if [ -n "$DOCKER_GID" ]; then \
57+ sudo groupadd -g $DOCKER_GID docker; \
58+ else \
59+ sudo groupadd docker; \
60+ fi \
61+ && sudo usermod -aG docker $USERNAME
5662
5763# __DEVCONTAINER_SNIPPET_INSERT__ (control where snippets get inserted using the devcontainer CLI)
5864
Original file line number Diff line number Diff line change 44 "name" : " dc-test" ,
55 "dockerFile" : " Dockerfile" ,
66 "build" : {
7+ "args" : {
8+ "DOCKER_GID" : " ${localEnv:DOCKER_GID}"
9+ },
710 "cacheFrom" : " ghcr.io/devcontainers/ci/tests/docker-from-docker-non-root:latest"
811 },
912
5558
5659 // Use 'postCreateCommand' to run commands after the container is created.
5760 "postCreateCommand" : " ./scripts/go-tools.sh" ,
61+ "postStartCommand" : " echo 'UID INFO'; id; ls -l /var/run/docker.sock" ,
5862
5963 "remoteUser" : " vscode" ,
6064
You can’t perform that action at this time.
0 commit comments