# forward request and error logs to docker log collector
&& ln -sf /dev/stdout /var/log/nginx/access.log
&& ln -sf /dev/stderr /var/log/nginx/error.log可见nginx镜像创建时候就定义好了日志文件的输出。
同样使用docker stop 524清理现场,以后就不再介绍清理这一步骤了。
mysql容器日志
启动一个mysql容器
docker run --rm -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7不难看到mysql容器日志输出, 截取其中片段如下:
Initializing database
2019-03-24T08:48:19.102726Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2019-03-24T08:48:20.241459Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-03-24T08:48:20.414933Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-03-24T08:48:20.509897Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 935a6ee7-4e11-11e9-b135-0242ac110002.
2019-03-24T08:48:20.519148Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2019-03-24T08:48:20.519843Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the –initialize-insecure option.
2019-03-24T08:48:24.066683Z 1 [Warning] ‘user’ entry ‘root@localhost’ ignored in –skip-name-resolve mode.
2019-03-24T08:48:24.066730Z 1 [Warning] ‘user’ entry ‘mysql.session@localhost’ ignored in –skip-name-resolve mode.
2019-03-24T08:48:24.066740Z 1 [Warning] ‘user’ entry ‘mysql.sys@localhost’ ignored in –skip-name-resolve mode.
2019-03-24T08:48:24.066756Z 1 [Warning] ‘db’ entry ‘performance_schema mysql.session@localhost’ ignored in –skip-name-resolve mode.
2019-03-24T08:48:24.066761Z 1 [Warning] ‘db’ entry ‘sys mysql.sys@localhost’ ignored in –skip-name-resolve mode.
2019-03-24T08:48:24.066772Z 1 [Warning] ‘proxies_priv’ entry ‘@ root@localhost’ ignored in –skip-name-resolve mode.
2019-03-24T08:48:24.066814Z 1 [Warning] ‘tables_priv’ entry ‘user mysql.session@localhost’ ignored in –skip-name-resolve mode.
2019-03-24T08:48:24.066822Z 1 [Warning] ‘tables_priv’ entry ‘sys_config mysql.sys@localhost’ ignored in –skip-name-resolve mode.
Database initialized
Initializing certificates
Generating a RSA private key
查看mysql Dockerfile 文件,可以知道mysql镜像启动入口在entrypoint.sh,从脚本中发现:










