Ik wil dat wanneer iemand een button aanklikt er een Docker container opgestart wordt.
onder /var/www/html staat webscript.php
onder /var/www/cgi-bin staat docker_run.sh
webscript.php
<?php
if($_POST["submitted"])
{
exec ('/var/www/cgi-bin/docker_run.sh');
}
?>
<!DOCTYPE html>
<html>
<head>
<title>?</title>
</head>
<body>
<form method="post">
<input type="hidden" name="submitted">
<button type="submit">Run the script!</button>
</form>
<form action="exec(/var/www/cgi-bin/docker_run.sh)">
<input type="submit" value="Open Script">
</form>
</body>
</html>
docker_run.sh
#!/bin/bash
for i in {1..10}
do docker run -name docker-nginx$i -P -d nginx
sleep 3
done