The first step: direct pull LAMP mirror mirror warehouse
[root@ken-node3 ken]# docker pull tutum/lamp
Step two: Check the mirror has been acquired
[root@ken-node3 ken]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
tutum/lamp latest 3d49e175ec00 3 years ago 427MB
The third step: Start container
[root@ken-node3 ken]# docker run -p 80:80 -p 3306:3306 -v /ken:/var/www/html -v /ken1:/var/lib/mysql -d tutum/lamp
Command interpretation:
Port Mapping The machine is easy to port 80 to port 80, port 80 to ensure that the machine is not occupied
Native port mapping port 3306 to port 3306 easy to ensure that the machine is not occupied port 3306
Directory mapping of the machine / ken directory to the root of the site container for data persistence and ease of management
/ Ken1 Catalog mapped to the container of the present machine database file directory, to enable data to facilitate management and persistence
The container running in the background
Step four: Prepare wordpress installation package to the next / ken directory, and database user name and editing
[root@ken-node3 ken]# ls
wordpress wordpress-3.3.1-zh_CN.zip
[root@ken-node3 ken]# cp wordpress/* . -a
[root@ken-node3 ken]# ls index.php wordpress-3.3.1-zh_CN.zip wp-blog-header.php wp-cron.php wp-login.php wp-settings.php license.txt wp-activate.php wp-comments-post.php wp-includes wp-mail.php wp-signup.php readme.html wp-admin wp-config-sample.php wp-links-opml.php wp-pass.php wp-trackback.php wordpress wp-app.php wp-content wp-load.php wp-register.php xmlrpc.php [root@ken-node3 ken]# cp wp-config-sample.php wp-config.php [root@ken-node3 ken]# vim wp-config.php
Step 5: Enter the appropriate database and easily create user
[root@ken-node3 ken]# docker exec -it 9dbad46eb3f2 bash
root@9dbad46eb3f2:/# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database ken; Query OK, 1 row affected (0.00 sec) mysql> grant all on *.* to ken@'localhost' identified by '123'; Query OK, 0 rows affected (0.00 sec) mysql> grant all on *.* to ken@'%' identified by '123'; Query OK, 0 rows affected (0.01 sec) mysql> exit Bye
Step Six: browser access
slightly