Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

docker-machine echo fail #4888

Open
FxNion opened this issue May 12, 2021 · 0 comments
Open

docker-machine echo fail #4888

FxNion opened this issue May 12, 2021 · 0 comments

Comments

@FxNion
Copy link

FxNion commented May 12, 2021

Suppose you want to script file conf enhancement from you host to your docker-machine instance:
For all the cases below, no file is created as expected

docker-machine ssh mymachine echo test_string > test.txt 
docker-machine ssh mymachine echo test_string | tee test.txt 
docker-machine ssh mymachine bash -c "echo test_string > test.txt"
docker-machine ssh mymachine bash -c "echo test_string | tee test.txt" 
docker-machine ssh mymachine sudo bash -c "echo test_string > test.txt"
docker-machine ssh mymachine sudo bash -c "echo test_string | tee test.txt"
docker-machine ssh mymachine sudo bash -c "echo test_string | sudo tee test.txt"

Wether the file test.txt exists on the machine, a blank line is appended instead of the expected string with the commands below:

docker-machine ssh mymachine echo test_string >> test.txt  
docker-machine ssh mymachine echo test_string | tee test.txt
docker-machine ssh mymachine bash -c "echo test_string >> test.txt" 
docker-machine ssh mymachine bash -c "echo test_string | tee -a test.txt" 
docker-machine ssh mymachine sudo bash -c "echo test_string >> test.txt" 
docker-machine ssh mymachine sudo bash -c "echo test_string | tee -a test.txt" 
docker-machine ssh mymachine sudo bash -c "echo test_string | sudo tee -a test.txt" 

Tested with the driver openstack, on Debian buster, updated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant