Skip to content

Instantly share code, notes, and snippets.

@sashaaro
Last active April 18, 2020 10:32
Show Gist options
  • Save sashaaro/0c990f35d3f0ce5a99f80643537ab612 to your computer and use it in GitHub Desktop.
Save sashaaro/0c990f35d3f0ce5a99f80643537ab612 to your computer and use it in GitHub Desktop.
recompile origin image with your user
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
./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