mattrayner / docker-lamp

A simple LAMP image using Ubuntu, Apache, PHP and MySql in a single image
Apache License 2.0
592 stars 262 forks source link

Debug: cannot read stdout #108

Open pdwonline opened 4 years ago

pdwonline commented 4 years ago

I am using STDOUT messages for logging purposes like this:

fwrite(STDOUT, $msg);

Normally I would expect this to become visible in docker by the command:

docker logs <CONTAINER_ID> but I don't see any output. What is going wrong here?

freakpants commented 4 years ago

Shouldn't it be docker logs CONTAINER_ID ?

pdwonline commented 4 years ago

Shouldn't it be docker logs CONTAINER_ID ?

You're right, that's what I mean. but still it doesn't give me output

freakpants commented 4 years ago
$ docker run -d mattrayner/lamp
3c9dde198df2a9771c557b8c42472722f66d6c367e1d9649b218ebf396b56182

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
3c9dde198df2        mattrayner/lamp     "/run.sh"           2 seconds ago       Up 1 second         80/tcp, 3306/tcp    unruffled_mcnulty

$ docker logs 3c9dde198df2
Updating for PHP 7.4
Replacing CLI php.ini values
Editing APACHE_RUN_GROUP environment variable
Editing phpmyadmin config
Setting up MySQL directories
Allowing Apache/PHP to write to the app
Allowing Apache/PHP to write to MySQL
Editing MySQL config
=> An empty or uninitialized MySQL volume is detected in /var/lib/mysql
=> Installing MySQL ...
=> Done!
=> Waiting for confirmation of MySQL service startup
=> Creating MySQL admin user with random password
ERROR 1133 (42000) at line 1: Can't find any matching row in the user table
=> Done!
========================================================================
You can now connect to this MySQL Server with C7Ca5YjMBVvP

    mysql -uadmin -pC7Ca5YjMBVvP -h<host> -P<port>

Please remember to change the above password as soon as possible!
MySQL user 'root' has no password but only allows local connections

enjoy!
========================================================================
Starting supervisord
2020-09-01 07:22:10,274 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2020-09-01 07:22:10,274 INFO Included extra file "/etc/supervisor/conf.d/supervisord-apache2.conf" during parsing
2020-09-01 07:22:10,274 INFO Included extra file "/etc/supervisor/conf.d/supervisord-mysqld.conf" during parsing
2020-09-01 07:22:10,277 INFO RPC interface 'supervisor' initialized
2020-09-01 07:22:10,277 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2020-09-01 07:22:10,277 INFO supervisord started with pid 1
2020-09-01 07:22:11,279 INFO spawned: 'apache2' with pid 503
2020-09-01 07:22:11,281 INFO spawned: 'mysqld' with pid 504
2020-09-01 07:22:12,549 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-09-01 07:22:12,550 INFO success: mysqld entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

works fine for me, are you doing something different?