Last active
April 18, 2020 10:32
-
-
Save sashaaro/0c990f35d3f0ce5a99f80643537ab612 to your computer and use it in GitHub Desktop.
recompile origin image with your user
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
originalImage=$1 | |
if [ -z $2 ]; then | |
newImage=$originalImage | |
else | |
newImage=$2; | |
fi; | |
if [ $newImage == $originalImage ]; then | |
echo -e "\033[0;31mOriginal image $originalImage recompile...\033[0m" | |
fi; | |
docker build -t $newImage -<<EOF | |
FROM $originalImage | |
RUN addgroup -g $(id -g) my && adduser -u $(id -u) -G my -D me | |
USER me | |
EOF |
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
./build-local-image.sh alpine my-alpine | |
docker history my-alpine | |
docker run --rm my-alpine id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment