English | 中文
If your native environment does not meet the EasySwoole system requirements, or if you are unfamiliar with system configuration, you can run and develop the EasySwoole project as follows using Docker.
In the following example the host will be mapped to the local directory /workspace/project
:
If
the selinux-enabled
option is enabled when docker starts, access to host resources in the container will be restricted, so you should add the--privileged -u root
option when starting the container.
docker run --name easyswoole \
-v /workspace/project:/var/www/project \
-p 9501:9501 -it \
--privileged -u root \
--entrypoint /bin/sh \
easyswoolexuesi2021/easyswoole:php8.2.17-alpine3.19-swoole5.1.1
The public images you can choose from:
easyswoolexuesi2021/easyswoole:php7.3.33-alpine3.12-swoole4.4.26
easyswoolexuesi2021/easyswoole:php7.4.33-alpine3.15-swoole4.4.26
easyswoolexuesi2021/easyswoole:php8.1.22-alpine3.16-swoole4.8.13
easyswoolexuesi2021/easyswoole:php8.1.22-alpine3.16-swoole5.1.1
easyswoolexuesi2021/easyswoole:php8.1.27-alpine3.18-swoole4.8.13
easyswoolexuesi2021/easyswoole:php8.1.27-alpine3.18-swoole5.1.1
easyswoolexuesi2021/easyswoole:php8.2.8-alpine3.18-swoole4.8.13
easyswoolexuesi2021/easyswoole:php8.2.8-alpine3.18-swoole5.1.1
easyswoolexuesi2021/easyswoole:php8.2.14-alpine3.19-swoole4.8.13
easyswoolexuesi2021/easyswoole:php8.2.14-alpine3.19-swoole5.1.1
easyswoolexuesi2021/easyswoole:php8.2.17-alpine3.19-swoole4.8.13
easyswoolexuesi2021/easyswoole:php8.2.17-alpine3.19-swoole5.1.1
easyswoolexuesi2021/easyswoole:php8.3.4-alpine3.19-swoole5.1.2
cd /var/www/project
composer require easyswoole/easyswoole
php vendor/bin/easyswoole.php install
# php vendor/bin/easyswoole install # When the EasySwoole framework version in your project is less than 3.7.1.
In some environments, such as the
Docker
environment of theWin10
system. Virtual machine shared directory cannot be used as theTemp
directory of theEasySwoole
framework, as it will not be able to create sockets due to insufficient permissions. This will result in an error message:listen xxxxx.lock fail
. To do so, you can manually setTEMP_DIR
in thedev.php
configuration file, Change the DIR directory to a different path, such as'/tmp'
.
cd /var/www/project
php easyswoole.php server start
# php easyswoole server start # When the EasySwoole framework version in your project is less than 3.7.1.
Next, you can see your installed project in /var/www/project
. Since EasySwoole is a persistent CLI framework, when you have modified your code, you should terminate the running process instance with CTRL + C
and re-execute the php easyswoole server start
start startup command to restart your server and reload the code.
tag format:
- 7.4: php version, support 7.3/7.4/8.1/8.2, Recommend 7.4
- 3.12: alpine version, support alpine 3.12/3.15/3.16/3.18, recommend 3.15
- 4.4.26: swoole version
support:
Added Dockerfile to your project.
Base image contains extensions below:
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
gd
hash
iconv
igbinary
json
libxml
mbstring
mongodb
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
SimpleXML
sockets
sodium
SPL
standard
swoole
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache