-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
piping a file to a python script using exec_run #1637
Comments
Try |
Thanks, @shin- This workaround works perfectly.But I used another hacky way to implement the same. |
container.exec_run(['sh', '-c', 'echo 5 | python test.py']) in this command where to specify the container name? |
@shin- Your workaround works great, it just solved a problem I have been facing for a few hours now, so thank you. However, I don't understand why it is needed to prefix the required command with EDIT |
client = docker.from_env()
container = client.containers.get('enter container ID here')
container.exec_run(...) |
Thank you dude. |
Using the docker python SDK, I'm trying to pipe output of an echo command to exec_run as follows.
container.exec_run(['echo','5','|','python','test.py'])
the test.py has following code
The output that is produced is :
b'5 | python test.py\n'
I'm trying to mimic the following vanila linux command
echo "5" | python myscript.py
The text was updated successfully, but these errors were encountered: