I'm trying to create a new Droplet and then kick off a Docker command via a UserData bash script. I set the user data via the Java API when creating the droplet and observe that the test files and logs I made are created.
newDroplet.setUserData("#!/bin/bash\n" +
"touch /test.txt;"+
"docker login --username=myname--password=mypass > /loginlog;"+
"docker pull mybuild > /pulllog;"+
"docker run --log-opt max-size=1g --net host --name myserver -t -i mybuild > /runlog;");
loginlog and pulllog both show successful outcomes. However nothing exists in the file runlog.
I can ssh into the droplet and then run the exact same docker command and it runs as expected. Why can't it be run from a userdata script? Why is no output generated?