Skip to content

Commit b65e487

Browse files
committed
fix: determine the correct Docker socket from the context
1 parent 9dc4bd5 commit b65e487

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/actions/build-docker-image/action.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ runs:
9595
env:
9696
SOURCE_DATE_EPOCH: 0
9797

98-
- run: docker context ls
99-
shell: bash
100-
10198
- name: Get image name
10299
shell: bash
103100
id: imagename
@@ -154,11 +151,16 @@ runs:
154151
echo "hash=" >> "${GITHUB_OUTPUT}"
155152
fi
156153
154+
- name: Get Docker socket
155+
id: socket
156+
run: echo docker_socket="$(docker context ls --format json | jq -r 'select(.Current == true) | .DockerEndpoint' | sed 's!^unix://!!')" >> "${GITHUB_OUTPUT}"
157+
shell: bash
158+
157159
- name: Security Scan
158160
shell: bash
159161
run: |
160162
docker run --rm \
161-
-v /var/run/docker.sock:/var/run/docker.sock \
163+
-v ${{ steps.socket.outputs.docker_socket }}:/var/run/docker.sock \
162164
-v $(pwd)/.cache:/root/.cache \
163165
-v $(pwd):/workdir \
164166
-w /workdir \

0 commit comments

Comments
 (0)