Skip to content

Instantly share code, notes, and snippets.

@jaytaylor
Created March 24, 2017 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaytaylor/48aeb50ed75713aec8d2bdd1a384e97b to your computer and use it in GitHub Desktop.
Save jaytaylor/48aeb50ed75713aec8d2bdd1a384e97b to your computer and use it in GitHub Desktop.
Quick one-liner for copying a binary into a running docker container.
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
cmd=nc ; cid=4fd9addc9980 ; base64 < $(command -v $cmd) > /tmp/b64 && sudo docker exec -i $cid bash -c "set -e && base64 --decode > /tmp/$cmd && chmod a+x /tmp/$cmd" < /tmp/b64 && sudo docker exec -it $cid bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment