---
# System prepended metadata

title: Wordpress with Docker

---

# Wordpress with Docker

## Run wordpress in localhost
- Download wordpress from https://wordpress.org/ & **extract file**
- Add docker-compose.yaml
```
version: "3.9"

services:
  db:
    image: mariadb:10.5.9
    volumes:
      - ./db_data:/var/lib/mysql
    expose:
      - "3306"
    ports:
      - "3308:3306"
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: webthietke
      MYSQL_DATABASE: webthietke

  app:
    depends_on:
      - db
    image: wordpress:latest
    volumes:
      - .:/var/www/html
    ports:
      - "8000:80"
    restart: always
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: webthietke
      WORDPRESS_DB_NAME: webthietke
```
- Open http://localhost:8000/ to check

## Errors

### can not create folder wp-content/uploads
exec to app bash and run
```
$ chown -R www-data:www-data /var/www
$ find /var/www/ -type d -exec chmod 0755 {} \;
$ find /var/www/ -type f -exec chmod 644 {} \;
```


