无法访问docker上的wordpress网站

时间:2018-12-25 14:36:25

标签: mysql wordpress docker docker-compose

我正在尝试创建一个将运行3个容器的docker机器: WordPress,MySQL和phpMyAdmin。这是我的docker compose文件:

version: '3.1'

services:

  wordpress:
    volumes:
      - E:\Demo Sites\testSite\public_html:/var/www/html
    depends_on:
      - db
    image: wordpress:latest
    restart: unless-stopped
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: user2
      WORDPRESS_DB_PASSWORD: pass2
      WORDPRESS_DB_NAME: db2

  db:
    image: mysql:5.7
    restart: always
    ports:
      - 3306:3306
    environment:
      MYSQL_DATABASE: db2
      MYSQL_USER: user2
      MYSQL_PASSWORD: pass2
      MYSQL_ROOT_PASSWORD: test_pass2
    volumes:
      - db_data:/var/lib/mysql

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    links:
      - db:db
    restart: always
    depends_on:
      - db
    ports:
      - 9191:80
    environment:
      MYSQL_USERNAME: root
      MYSQL_ROOT_PASSWORD: test_pass2
      MYSQL_PASSWORD: test_pass2
volumes:
  db_data:

我跑了docker system prune是为了重新开始。然后,我使用docker-compose up运行了文件。 phpMyAdmin可以正常工作,但是我无法到达192.168.99.100:8080的wordpress网站。这些是日志:

Creating demosites_db_1 ... done
Creating demosites_phpmyadmin_1 ... done
Creating demosites_wordpress_1  ... done
Attaching to demosites_db_1, demosites_phpmyadmin_1, demosites_wordpress_1
db_1          | 2018-12-25T14:30:06.003349Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1          | 2018-12-25T14:30:06.014038Z 0 [Note] mysqld (mysqld 5.7.24) starting as process 1 ...
db_1          | 2018-12-25T14:30:06.030769Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1          | 2018-12-25T14:30:06.030841Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1          | 2018-12-25T14:30:06.030868Z 0 [Note] InnoDB: Uses event mutexes
db_1          | 2018-12-25T14:30:06.030890Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1          | 2018-12-25T14:30:06.030911Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db_1          | 2018-12-25T14:30:06.030932Z 0 [Note] InnoDB: Using Linux native AIO
db_1          | 2018-12-25T14:30:06.043746Z 0 [Note] InnoDB: Number of pools: 1
db_1          | 2018-12-25T14:30:06.075840Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1          | 2018-12-25T14:30:06.084608Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1          | 2018-12-25T14:30:06.147100Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1          | 2018-12-25T14:30:06.196456Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1          | 2018-12-25T14:30:06.245622Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
db_1          | 2018-12-25T14:30:06.503315Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1          | 2018-12-25T14:30:06.504395Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1          | 2018-12-25T14:30:06.739272Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1          | 2018-12-25T14:30:06.742497Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
db_1          | 2018-12-25T14:30:06.743304Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
db_1          | 2018-12-25T14:30:06.744156Z 0 [Note] InnoDB: Waiting for purge to start
db_1          | 2018-12-25T14:30:06.796032Z 0 [Note] InnoDB: 5.7.24 started; log sequence number 12372193
db_1          | 2018-12-25T14:30:06.796536Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1          | 2018-12-25T14:30:06.797064Z 0 [Note] Plugin 'FEDERATED' is disabled.
db_1          | 2018-12-25T14:30:06.886235Z 0 [Note] InnoDB: Buffer pool(s) load completed at 181225 14:30:06
db_1          | 2018-12-25T14:30:06.912383Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
db_1          | 2018-12-25T14:30:06.916997Z 0 [Warning] CA certificate ca.pem is self signed.
db_1          | 2018-12-25T14:30:06.934450Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
db_1          | 2018-12-25T14:30:06.936498Z 0 [Note] IPv6 is available.
db_1          | 2018-12-25T14:30:06.937204Z 0 [Note]   - '::' resolves to '::';
db_1          | 2018-12-25T14:30:06.937558Z 0 [Note] Server socket created on IP: '::'.
db_1          | 2018-12-25T14:30:06.959182Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1          | 2018-12-25T14:30:06.967176Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
db_1          | 2018-12-25T14:30:06.967504Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1          | 2018-12-25T14:30:06.967822Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1          | 2018-12-25T14:30:06.968512Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1          | 2018-12-25T14:30:06.968914Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1          | 2018-12-25T14:30:06.969441Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
db_1          | 2018-12-25T14:30:06.997582Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1          | 2018-12-25T14:30:06.997923Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1          | 2018-12-25T14:30:07.085365Z 0 [Note] Event Scheduler: Loaded 0 events
phpmyadmin_1  | phpMyAdmin not found in /var/www/html - copying now...
wordpress_1   | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.4. Set the 'ServerName' directive globally to suppress this message
wordpress_1   | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.4. Set the 'ServerName' directive globally to suppress this message
wordpress_1   | [Tue Dec 25 14:30:09.921193 2018] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.13 configured -- resuming normal operations
phpmyadmin_1  | Complete! phpMyAdmin has been successfully copied to /var/www/html
phpmyadmin_1  | /usr/lib/python2.7/site-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
phpmyadmin_1  |   'Supervisord is running as root and it is searching '
phpmyadmin_1  | 2018-12-25 14:30:10,239 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.
phpmyadmin_1  | 2018-12-25 14:30:10,240 INFO Included extra file "/etc/supervisor.d/nginx.ini" during parsing
phpmyadmin_1  | 2018-12-25 14:30:10,241 INFO Included extra file "/etc/supervisor.d/php.ini" during parsing
phpmyadmin_1  | 2018-12-25 14:30:10,276 INFO RPC interface 'supervisor' initialized
phpmyadmin_1  | 2018-12-25 14:30:10,277 CRIT Server 'unix_http_server' running without any HTTP authentication checking
phpmyadmin_1  | 2018-12-25 14:30:10,278 INFO supervisord started with pid 1
phpmyadmin_1  | 2018-12-25 14:30:11,283 INFO spawned: 'php-fpm' with pid 21
phpmyadmin_1  | 2018-12-25 14:30:11,291 INFO spawned: 'nginx' with pid 22
phpmyadmin_1  | [25-Dec-2018 14:30:11] NOTICE: fpm is running, pid 21
phpmyadmin_1  | [25-Dec-2018 14:30:11] NOTICE: ready to handle connections
phpmyadmin_1  | 2018-12-25 14:30:12,466 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

此外,我可以看到在E:/ Demo Sites下没有创建文件夹。它曾经完美地工作过,因此我对此一无所知。预先感谢。

编辑:我发现,如果我在站点内写任何路径(即192.168.99.100:8080/aaa),它将起作用并带我进入wordpress安装页面。我完全不知道为什么,但是它确实有效。

1 个答案:

答案 0 :(得分:0)

我认为您需要指定WordPress也依赖PHP