run command on machine

I want to run some commands on Machine like doing a curl to s3 to pull some files, compile those files by running g++ -o and copy the generated output back to s3 or to some other places.

So, I first created a machine like this flyctl machine run gcc:latest and then run flyctl machine exec machine-id "gcc --version" but it returned Error: could not exec command on machine machine-id: failed to exec on VM machine-id: failed_precondition: machine not running

Why does the VM stop after it has been created? I dont want it to stop until i tell it to stop/destroy

The VM stops because the default CMD exits immediately (presumably, gcc). You can make it run forever with flyctl machine run gcc:latest sleep inf

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.