Skip to content

Instantly share code, notes, and snippets.

@knwng
Created January 30, 2023 07:16
Show Gist options
  • Save knwng/69da97a31791e6c960231063d14e1366 to your computer and use it in GitHub Desktop.
Save knwng/69da97a31791e6c960231063d14e1366 to your computer and use it in GitHub Desktop.
change mod of directory inside docker images
#!/bin/bash
IMAGE_ID="65c89db00d47"
DIR="tmp"
RAW=$(docker inspect "${IMAGE_ID}" | jq '.[].GraphDriver.Data.LowerDir' -r)
IFS=':' read -r -a DATA <<< "${RAW}"
for s in ${DATA[@]}; do
ret=$(sudo ls $s)
for i in $ret; do
if [[ "$i" == "${DIR}" ]]; then
echo "${s}/${DIR}"
sudo chmod -R 777 "${s}/${DIR}"
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment