N
N
Nubbb2020-07-17 11:02:42
Docker
Nubbb, 2020-07-17 11:02:42

docker install wordpress?

docker-compose.yml file

version: '3.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:
      - ./:/var/www
    working_dir: /var/www
    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: {}

everything is installed only when I open the site, writes

Forbidden
You don't have permission to access this resource.

Apache/2.4.38 (Debian) Server at localhost Port 8000

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-07-17
@q2digger

where did you get this from?


volumes:
- ./:/var/www

Here is the docker-compose.yml from the official page, compare
version: '3.1'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - wordpress:/var/www/html

  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - db:/var/lib/mysql

volumes:
  wordpress:
  db:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question