mardi 26 juillet 2016

docker-machine inside Symfony Process

I have Laravel 5.2 and try to do something like this

namespace AppJobs;

use AppJobsJob;
use IlluminateQueueSerializesModels;
use IlluminateQueueInteractsWithQueue;
use IlluminateContractsQueueShouldQueue;
use SymfonyComponentProcessProcess;
use SymfonyComponentProcessExceptionProcessFailedException;

class MachineCreate extends Job implements ShouldQueue
{
    use InteractsWithQueue, SerializesModels;

    /**
     * Create a new job instance.
     *
     */
    public function __construct()
    {
        //
    }

    /**
     * Execute the job.
     *
     */
    public function handle()
    {
        $process = new Process('docker-machine create --driver digitalocean --digitalocean-access-token *** do-test');
        $process->setTimeout(600);
        $process->run();

        // executes after the command finishes
        if (!$process->isSuccessful()) {
            throw new ProcessFailedException($process);
        }
    }
}

Every time i do this i have error:

Driver "digitalocean" not found. Do you have the plugin binary accessible in your PATH?

But if i do same in php artisan tinker i have no errors, everething works fine.

Any ideas what i am doing wrong?

Aucun commentaire:

Enregistrer un commentaire