Skip to content

Commit

Permalink
Use CONTAINER_NAME if set (#1223)
Browse files Browse the repository at this point in the history
Support cgroups v2 systems such as Docker Desktop for Mac 4.3+.
  • Loading branch information
ewhamilton committed Feb 5, 2022
1 parent 307b053 commit 0c2ea06
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ build_licenses_info_image() {
local src_dir="$(pwd)"
local target_file="$(pwd)/licenses"
local mount_cmd="-v $(pwd):$(pwd)"
if grep docker /proc/1/cgroup -qa; then
# Checking if executed inside docker container
if [ -n "${CONTAINER_NAME:-}" ]; then
mount_cmd="--volumes-from ${CONTAINER_NAME}"
elif grep docker /proc/1/cgroup -qa; then
mount_cmd="--volumes-from $(grep docker -m 1 /proc/self/cgroup|cut -d/ -f3)"
fi
docker run --rm ${mount_cmd} \
Expand Down

0 comments on commit 0c2ea06

Please sign in to comment.