Skip to content

Instantly share code, notes, and snippets.

@Galadirith
Forked from mbreese/docker-heredoc-snippet
Created February 10, 2022 12:30
Show Gist options
  • Save Galadirith/ce44ae5c8109eb716f8c60e300aaca67 to your computer and use it in GitHub Desktop.
Save Galadirith/ce44ae5c8109eb716f8c60e300aaca67 to your computer and use it in GitHub Desktop.
Running docker with a HEREDOC to script the commands to run inside the container.
docker run -v /Users/mbreese/tmp:/tmp1 -w /tmp1 -i centos:7 /bin/bash -s <<EOF
date > foo
echo 'foo' >> foo
cat /etc/redhat-release >> foo
whoami >> foo
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment