docker搭建wordpress
Posted 偏安一隅能苟生,依傍山水且独行;
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker搭建wordpress相关的知识,希望对你有一定的参考价值。
闲话少说,奉上干货
一、 创建nginx镜像
mkdir docker
cd docker
cat Dockerfile
FROM centos:centos7
MAINTAINER woodman
RUN yum -y install wget
RUN rm -f /etc/yum.repos.d/*
RUN wget http://mirrors.163.com/.help/CentOS7-Base-163.repo && mv CentOS7-Base-163.repo /etc/yum.repos.d/163.repo
RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN cd /etc/pki/rpm-gpg/
RUN wget https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
RUN rpm –import RPM-GPG-KEY-EPEL-7
RUN yum clean all
RUN yum install httpd php php-mysql php-mbstring -y && yum clean all
EXPOSE 80
CMD [“/usr/sbin/httpd”,”-f”,”/etc/httpd/conf/httpd.conf”,”-DFOREGROUND”]
#创建
docker build -f Dockerfile -t web:centos7 .
二、创建mariadb镜像
三、关联容器
四、安装wordpress
cat /renn/myweb/wp-config.php <?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the * installation. You don‘t have to use the web site, you can * copy this file to "wp-config.php" and fill in the values. * * This file contains the following configurations: * * * MySQL settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://codex.wordpress.org/Editing_wp-config.php * * @package WordPress */ // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define(‘DB_NAME‘, ‘wordpress‘); /** MySQL database username */ define(‘DB_USER‘, ‘wordpress‘); /** MySQL database password */ define(‘DB_PASSWORD‘, ‘wordpress‘); /** MySQL hostname */ define(‘DB_HOST‘, ‘db‘); /** Database Charset to use in creating database tables. */ define(‘DB_CHARSET‘, ‘utf8mb4‘); /** The Database Collate type. Don‘t change this if in doubt. */ define(‘DB_COLLATE‘, ‘‘); /**#@+ * Authentication Unique Keys and Salts. * * Change these to different unique phrases! * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. * * @since 2.6.0 */ define(‘AUTH_KEY‘, ‘zOf g^[email protected]~eZy,kEsstBc+=3DjY;F`.7MKtOd_J4?`0tKv.r7B,cyHTC(c<L^pb‘); define(‘SECURE_AUTH_KEY‘, ‘?4a! VG;6DZwO_^aEm9%7zz=eV;O141za] NRk,vs0Zk#y{!ZMxveWa*?!=Lk34(‘); define(‘LOGGED_IN_KEY‘, ‘[email protected]@FV2EEX[g2FmENZ4sB{)k:x+W3{x?o1-K}$;UkzA @)IGzY6x[TaK?ninGkg:‘); define(‘NONCE_KEY‘, ‘EC95aN/5-hQUK%1t<UK6$BlS=ngt=eT>3m_h she31E5.8O&O;V5z`j6R71nCW>1‘); define(‘AUTH_SALT‘, ‘@xSzJTwfL^<7HJG8i`7:@Y1.$vT[0}AD,(:B:Emb`H142P4]P2*/y`V>nex94>et‘); define(‘SECURE_AUTH_SALT‘, ‘f*4R2&WrJd{XcL][Jn9#RM$1aLTzp1A1a|cj+$6?2^,W&|`t#4n7VL|n(=V1:,P_‘); define(‘LOGGED_IN_SALT‘, ‘*62i~DFK~&b8b#%UaZZiC72)W=$i;I`ZyU2w<_+Cb>ubVP/.J~i]a&#o8iM!5?6e‘); define(‘NONCE_SALT‘, ‘Caf6?g(]8b [email protected][pq9c4r,elRW_eZQE{oq!w_8,xd/qa`D[zMb-Pc!em_?}t:nVnx‘); /**#@-*/ /** * WordPress Database Table prefix. * * You can have multiple installations in one database if you give each * a unique prefix. Only numbers, letters, and underscores please! */ $table_prefix = ‘wp_‘; /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. * * For information on other constants that can be used for debugging, * visit the Codex. * * @link https://codex.wordpress.org/Debugging_in_WordPress */ define(‘WP_DEBUG‘, false); /* That‘s all, stop editing! Happy blogging. */ /** Absolute path to the WordPress directory. */ if ( !defined(‘ABSPATH‘) ) define(‘ABSPATH‘, dirname(__FILE__) . ‘/‘); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . ‘wp-settings.php‘);
以上是关于docker搭建wordpress的主要内容,如果未能解决你的问题,请参考以下文章