# How to install wordpress by docker?

**URL:** <https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126>\
**Category:** General\
**Tags:** docker\
**Created:** [October 21, 2017, 2:25am UTC](https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126 "2017-10-21T02:25:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![frank1983](https://avatars.discourse-cdn.com/v4/letter/f/3da27b/32.png) [@frank1983](https://forums.docker.com/u/frank1983)\
**Post date:** [October 21, 2017, 2:25am UTC](https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126/1 "2017-10-21T02:25:24Z")

</div>

> <https://stackoverflow.com/questions/46858936/how-to-install-wordpress-by-docker>

**I need deploy Wordpress in my new VPS, but I found that not work, and I testing again by docker official install guide, that should same status, I need your kindly help for the issue, appreciated!**

Official install guide:

> **[Quickstart: Compose and WordPress](https://docs.docker.com/compose/wordpress/)**
>
> You can use Docker Compose to easily run WordPress in an isolated environment built with Docker containers. This quick-start guide demonstrates how to use Compose to set up and run...

---

<div class="post-metadata">

**Author:** ![junius](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@junius](https://forums.docker.com/u/junius)\
**Post date:** [October 21, 2017, 7:02pm UTC](https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126/2 "2017-10-21T19:02:31Z")

</div>

what is the issue? did you expose wordpress’s port? the official docker compose should work.

---

<div class="post-metadata">

**Author:** ![frank1983](https://avatars.discourse-cdn.com/v4/letter/f/3da27b/32.png) [@frank1983](https://forums.docker.com/u/frank1983)\
**Post date:** [October 22, 2017, 1:18am UTC](https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126/3 "2017-10-22T01:18:35Z")

</div>

> [@junius](#):
>
> s’s port

Hi, Junius

As I understand, port 80 should default expose and not need extra config, please let me know if I am wrong.  
How do we verify whether wordpress work normal? As I said, no any respond by “curl”.

Thanks  
Yong

---

<div class="post-metadata">

**Author:** ![junius](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@junius](https://forums.docker.com/u/junius)\
**Post date:** [October 22, 2017, 3:55am UTC](https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126/4 "2017-10-22T03:55:43Z")

</div>

Could you please post details how you run wordpress?

wordpress container exposes port 80. but you need to publish it to a host port. `ports: - "8000:80"` in the compose file, or `-p 8080:80` in docker run.

---

<div class="post-metadata">

**Author:** ![frank1983](https://avatars.discourse-cdn.com/v4/letter/f/3da27b/32.png) [@frank1983](https://forums.docker.com/u/frank1983)\
**Post date:** [October 22, 2017, 4:09am UTC](https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126/5 "2017-10-22T04:09:13Z")

</div>

Hi, Junius

Follow detail information that I follow official docker install guide, you can check that:

```
[root@frank-vps my_wordpress]# more docker-compose.yml
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
     ports:
       - "8000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
volumes:
    db_data:
    [root@frank-vps my_wordpress]#
    [root@frank-vps my_wordpress]# docker ps
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    91f3d090a116 wordpress:latest "docker-entrypoint..." 26 hours ago Up 26 hours 0.0.0.0:8000->80/tcp mywordpress_wordpress_1
    b116d0cf4c67 mysql:5.7 "docker-entrypoint..." 26 hours ago Up 26 hours 3306/tcp mywordpress_db_1
[root@frank-vps my_wordpress]# curl localhost:8000
[root@frank-vps my_wordpress]#
[root@frank-vps my_wordpress]#
```

---

<div class="post-metadata">

**Author:** ![junius](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@junius](https://forums.docker.com/u/junius)\
**Post date:** [October 22, 2017, 4:40am UTC](https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126/6 "2017-10-22T04:40:57Z")

</div>

Could you please try to access via browser? The browser to `http://localhost:8000` will show the page. Not sure about curl.

---

<div class="post-metadata">

**Author:** ![frank1983](https://avatars.discourse-cdn.com/v4/letter/f/3da27b/32.png) [@frank1983](https://forums.docker.com/u/frank1983)\
**Post date:** [October 22, 2017, 3:51pm UTC](https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126/7 "2017-10-22T15:51:06Z")

</div>

Hi, Junius

Appreciated your kindlly help!  
If I do “docker run xxxx” that should not work for me, that maybe command not correct.  
Then I tried compose of docker, curl no any output, but not check web, after checked, as you said that should work. So curl no any output should normal.

When I test the compose of docker for Wordpress, share follow tips and experiences:

1. If you want to mapping the mysql and wordpress, can add follow config in compose

2. When you change “docker-compose.yml”, please not only use “docker-compose down” that will not delete all config/file, suggest you do “docker-compose down --volumes” that as install guide.

3. If you change database name, please add “WORDPRESS\_DB\_NAME: xxx” in environment part of Wordpress(docker-compose.yml), that should no this config in official install guide. So wordpress default connect database name is “wordpress”.

4. If you want to debug wordpress/mysql and check log, you can not add “-d”, use this “docker-compose up”

5. In order to restore mysql database, you can install phpmyadmin by docker, then add follow config to “docker-compose.yml”, and follow guide by “[https://hub.docker.com/r/phpmyadmin/phpmyadmin/](https://hub.docker.com/r/phpmyadmin/phpmyadmin/)”

Thanks again!  
Yong

---

<div class="post-metadata">

**Author:** ![hotbelgo](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/hotbelgo/32/16664_2.png) [@hotbelgo](https://forums.docker.com/u/hotbelgo)\
**Post date:** [November 3, 2017, 6:00pm UTC](https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126/8 "2017-11-03T18:00:01Z")

</div>

The problem is that these instructions say nothing about themes - where to put them and how to ensure edits show up; getting the database is only half of the story

---

<div class="post-metadata">

**Author:** ![vikramdurai](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vikramdurai](https://forums.docker.com/u/vikramdurai)\
**Post date:** [February 27, 2018, 4:37pm UTC](https://forums.docker.com/t/how-to-install-wordpress-by-docker/40126/9 "2018-02-27T16:37:17Z")

</div>

@frank1983

> If you want to debug wordpress/mysql and check log, you can not add “-d”, use this “docker-compose up”

That’s not entirely correct, Yong. You can connect to a docker container (started with “-d”) using `docker attach [CONTAINER NAME]` where `[CONTAINER NAME]` is the name of your container.
