我使用上一篇文章在过去的6个小时内一直在研究这个问题而没有成功。我目前正在Docker锅炉顶上的WP站点上工作。当我运行docker-compose up
并导航到localhost:8080
时,我收到以下错误:
在服务器端,我收到以下警告:
mysql_1 | 2018-06-12T20:03:03.976722Z 0 [Note] mysqld: ready for connections.
mysql_1 | Version: '5.7.22' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
wordpress_1 | WordPress not found in /var/www/html - copying now...
wordpress_1 | WARNING: /var/www/html is not empty - press Ctrl+C now if this is an error!
WP-load.php:
/** Define ABSPATH as this file's directory */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
/*
* If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
* doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
* of avoiding cases where the current directory is a nested installation, e.g. / is WordPress(a)
* and /blog/ is WordPress(b).
*
* If neither set of conditions is true, initiate loading the setup process.
*/
if ( file_exists( ABSPATH . 'wp-config.php') ) {
/** The config file resides in ABSPATH */
require_once( ABSPATH . 'wp-config.php' );
} elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
/** The config file resides one level above ABSPATH but is not part of another installation */
require_once( dirname( ABSPATH ) . '/wp-config.php' );
} else {
// A config file doesn't exist
define( 'WPINC', 'wp-includes' );
require_once( ABSPATH . WPINC . '/load.php' );
// Standardize $_SERVER variables across setups.
wp_fix_server_vars();
require_once( ABSPATH . WPINC . '/functions.php' );
$path = wp_guess_url() . '/wp-admin/setup-config.php';
/*
* We're going to redirect to setup-config.php. While this shouldn't result
* in an infinite loop, that's a silly thing to assume, don't you think? If
* we're traveling in circles, our last-ditch effort is "Need more help?"
*/
if ( false === strpos( $_SERVER['REQUEST_URI'], 'setup-config' ) ) {
header( 'Location: ' . $path );
exit;
}
docker-compose.yml
wordpress: # name of our wordpress container
depends_on: # container dependencies that need to be running first
- mysql
# image: wordpress:latest # image used by our container
image: wordpress:4.9.6-php7.0 # image used by our container
ports:
- "8080:80" # setting our ports for networking
restart: always
volumes: # this is where we tell Docker what to pay attention to
- ./app/wp-content:/var/www/html/wp-content # mapping our custom theme to the container
- ./app/wp-config.php:/var/www/html/wp-config.php # map our plugins to the container
networks:
- back
似乎无法找到问题所在?
答案 0 :(得分:2)
docker-compose文件中的卷太具体了 - 您需要公开/ var / www / html目录挂载本身,而不仅仅是wp-content或(确认!)wp-config.php文件