Docker官方文档:https://docs.docker.com/samples/wordpress/
[root@docker ~] [root@docker ~] [root@docker my_wordpress] [root@docker my_wordpress] version: "3" services: db: image: mysql:5.7 volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: somewordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on: - db image: wordpress:latest volumes: - wordpress_data:/var/www/html ports: - "8000:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress WORDPRESS_DB_NAME: wordpress volumes: db_data: {} wordpress_data: {} [root@docker my_wordpress] Creating network "my_wordpress_default" with the default driver Creating volume "my_wordpress_db_data" with default driver Creating volume "my_wordpress_wordpress_data" with default driver Pulling db (mysql:5.7)... 5.7: Pulling from library/mysql b380bbd43752: Pull complete f23cbf2ecc5d: Pull complete 30cfc6c29c0a: Pull complete b38609286cbe: Pull complete 8211d9e66cd6: Pull complete 2313f9eeca4a: Pull complete 7eb487d00da0: Pull complete a71aacf913e7: Pull complete 393153c555df: Pull complete 06628e2290d7: Pull complete ff2ab8dac9ac: Pull complete Digest: sha256:2db8bfd2656b51ded5d938abcded8d32ec6181a9eae8dfc7ddf87a656ef97e97 Status: Downloaded newer image for mysql:5.7 Creating my_wordpress_db_1 ... done Creating my_wordpress_wordpress_1 ... done [root@docker my_wordpress] CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES bc4c072050bb wordpress:latest "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:8000->80/tcp, :::8000->80/tcp my_wordpress_wordpress_1 d00f41b1eb49 mysql:5.7 "docker-entrypoint.s…" About a minute ago Up About a minute 3306/tcp, 33060/tcp my_wordpress_db_1 74ac7c819b66 wordpress "docker-entrypoint.s…" 22 minutes ago Up 22 minutes 0.0.0.0:1080->80/tcp, :::1080->80/tcp OLDwp e6b2d4ba4266 mysql:5.6 "docker-entrypoint.s…" 22 minutes ago Up 22 minutes 0.0.0.0:33306->3306/tcp, :::33306->3306/tcp OLDMysql
然后访问 :http:localhost:8000 就可以看到WordPress的安装界面了
mkdir my_wordpress/ cd my_wordpress/ vi docker-compose.yml docker-compose up -d docker ps
原文链接:https://blog.csdn.net/qq_55709726/article/details/121014042?ops_request_misc=&request_id=a044aca1869b47408aaae4503d18d443&biz_id=&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~koosearch~default-7-121014042-null-null.268%5Ev1%5Econtrol&utm_term=docker%E3%80%81wordpress%E3%80%81wordpress%E5%BB%BA%E7%AB%99%E3%80%81wordpress%E4%B8%BB%E9%A2%98%E3%80%81%E5%AE%B9%E5%99%A8%E9%95%9C%E5%83%8F%E3%80%81
© 版权声明
声明📢本站内容均来自互联网,归原创作者所有,如有侵权必删除。
本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。
THE END