Created
January 30, 2023 07:16
-
-
Save knwng/69da97a31791e6c960231063d14e1366 to your computer and use it in GitHub Desktop.
change mod of directory inside docker images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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