Closed wereset closed 3 years ago
example 02-www is also not ok, when configured the item COPY ./rootfilesystem/ / , 80 port not run , but it's ok when i remove this config
I just tested and both examples worked fine.
How did you build and start the containers? Did you clone the repository and run the examples without making any changes? Or, did you copy file Dockerfile
to some other places and tried to build an image with that?
Yes, i did not change anythins. Example 00 has not Dockerfile , and the docker-compose.yml is:
# This docker-compose.yml file shows how Supervisor program(s) are reloaded automatically when file changes detected
# under web root /var/www. There are two environment variables used:
# 1. AUTORELOAD_PROGRAMS: space-separated Supervisor program(s) to be reloaded when file changes detected. e.g.,
# AUTORELOAD_PROGRAMS: "swoole" # Autoreload Supervisor program "swoole" only.
# AUTORELOAD_PROGRAMS: "swoole nginx" # Autoreload Supervisor program "swoole" and "nginx".
# 2. AUTORELOAD_ANY_FILES: Optional. If set to "true", "1", "yes", or "y", reload Supervisor program(s) when any
# files under the root directory (/var/www in this example) is changed; otherwise, reload only when PHP file(s)
# are changed.
#
version: '3'
services:
app:
image: phpswoole/swoole
environment:
AUTORELOAD_PROGRAMS: "swoole"
AUTORELOAD_ANY_FILES: 0
ports:
- 80:9501
volumes:
- ./rootfilesystem/var/www:/var/www
root@**:/var/www# supervisorctl autoreload RUNNING pid 17, uptime 0:00:40 swoole FATAL command at '/var/www/server.php' is not executable supervisor>
This is my supervisorctl info, swoole command run failure. And it's ok when i change the command to: php /var/www/server.php
So the problem is that, the server.php
PHP files in your local copy are not executable. However, all of them are set to executable in the Git repository.
I'm wondering if the issue happens under certain environments only. Could you please share some more information about your local development environment? Are you using Linux or Windows? How did you clone the repository? (or, which tool did you use to clone the repository?) Thanks
Thank you very much! My steps:
So,if i download as zip ,It's not executable when i upload it , and i must set it to executable. Thanks!
It is happening here (macOS Big Sur + Docker CE 2.5.0.1) too.
Fortunately using my own Dockerfile then a RUN chmod +x /var/www/server.php
solves.
PS.: if you are on a Windows host, make sure line-endings of the /var/www/server.php
file are LF, not CRLF.
I made an adjustment in the Supervisor configuration files to start the servers by running PHP commands explicitly (commit). Hope that helps.
That is awesome because this removes the need for #!/usr/bin/env php
(that I always forget xD) as well.
example 00 cannot run as expected, if I configured like this: volumes:
when I configure with this volumn, 80 port not work; But it's ok when I remove the config.