准备镜像
docker pull phpswoole/swoole
配置php解释器
创建测试文件
#!/usr/bin/env php <?php declare(strict_types=1); use Swoole\Http\Request; use Swoole\Http\Response; use Swoole\Http\Server; $http = new Server("0.0.0.0", 9501); $http->on( "start", function (Server $http) { echo "Swoole HTTP server is started.\n"; } ); $http->on( "request", function (Request $request, Response $response) { $response->end("Hello, World!\n"); } ); $http->start();