The image of php that include swoole extension.
10K+
For example, if you want start a server you can use the below command to run a server container.
Note: Because in swoole start a server or use the asynchronous codes must be run in 'php-cli' environment so you have to use these tags whose suffixes are 'cli'.
docker run \
--name swoole-server-demo \
--restart=always \
--network "web" \
-v $PWD/src:/usr/app \
-d \
ldjbenben/swoole:4.1-php7.2-cli \
php /usr/app/index.php
You can find the source files of the demo in github
docker run \
--name swoole-client-demo \
--restart=always \
--network "web" \
-v "$PWD/src":/var/www/html \
-d \
ldjbenben/swoole:4.1-php7.2-fpm
Because we used the version of php-fpm to run the client application so we have to start a nginx container:
docker run \
--name $name \
--restart=always \
--network "web" \
-p 8080:80 \
-v $PWD/../swoole-client-demo/src:/usr/share/nginx/html/swoole-client-demo \
-v `pwd`/conf.d:/usr/share/nginx/conf.d \
-v `pwd`/nginx.conf:/etc/nginx/nginx.conf:ro \
-d \
nginx:alpine
If your server ip is '192.168.2.100' you can access 'http://192.168.2.100:8080' in the browser to see the result.
The browser will output ‘Hello Swoole!’ if everything is ok.
Content type
Image
Digest
Size
164 MB
Last updated
over 6 years ago
docker pull ldjbenben/swoole:4.4.16-php7.3-cli