Created
April 29, 2021 18:01
-
-
Save umputun/525f57dcdbc869573a02e1d3277e0079 to your computer and use it in GitHub Desktop.
attach to scratch-based (running) container
This file contains hidden or 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/sh | |
docker run -d --rm --name=bbox busybox:latest sleep 10 1>/dev/null 2>/dev/null | |
docker cp bbox:/bin/busybox . | |
docker cp ./busybox "$1":/busybox | |
rm -f ./busybox | |
docker exec -u 0 -it "$1" /busybox sh -c ' | |
export PATH="/busybin:$PATH" | |
/busybox mkdir /busybin 2>/dev/null | |
/busybox --install /busybin | |
sh | |
/busybox rm -rf /busybin /busybox | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updated version, resolves conflict of two
dk.sh
on the exit: