Skip to content

Instantly share code, notes, and snippets.

@lflucasferreira
Last active April 26, 2021 17:38
Show Gist options
  • Save lflucasferreira/02938b8b314be4614e711232a9388c6a to your computer and use it in GitHub Desktop.
Save lflucasferreira/02938b8b314be4614e711232a9388c6a to your computer and use it in GitHub Desktop.
Docker Exec Xargs
export DOCKER_HOST=127.0.0.1
$ docker start alpine | xargs -I{} bash -c 'docker exec -it {} sh'
# xargs executes command on a new child process.
# So you need to reopen STDIN to child process for interactive communication. (MacOS: -o option)
$ docker start alpine | xargs -I{} -o docker exec -it {} sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment