execute command added to do.php
This commit is contained in:
parent
0877b4faff
commit
2000f98b70
12
pages/do.php
12
pages/do.php
|
@ -30,6 +30,18 @@ if(isset($_SESSION['LOGIN']))
|
|||
$dockerClient->startContainer($container['Id']);
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['do-command']))
|
||||
{
|
||||
if(isset($_REQUEST['commandtext']))
|
||||
{
|
||||
$filename = "/tmp/command".time().".txt";
|
||||
$command = trim($_REQUEST['commandtext']);
|
||||
file_put_contents($filename, $command);
|
||||
|
||||
exec('cat '.$filename.' | socat EXEC:"docker attach '.$container['Id'].'",pty STDIN');
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: index.php");
|
||||
die();
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue