Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

docker-machine echo fail #4888

@FxNion

Description

@FxNion

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions