admin管理员组

文章数量:1122832

I have created the below docker compose file and used the official WordPress image to transfer my site from shared hosting to docker. Despite using the standard .htaccess file and adding exit; in index.php for testing purposes, the WordPress site remains inaccessible. I've also made the necessary changes in wp-config. I am unable to troubleshoot further, please help

version: '3.1'

services:

  wordpress:
    container_name: frix_wordpress
    build:
      context: .
      dockerfile: Dockerfile
    image: wordpress
    restart: always
    working_dir: /var/www/html
    
    depends_on:
      - db
    ports:
      - 8099:8082
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - .:/var/www/html
  db:
    container_name: frix_db
    image: mysql:8.0
    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:

I have created the below docker compose file and used the official WordPress image to transfer my site from shared hosting to docker. Despite using the standard .htaccess file and adding exit; in index.php for testing purposes, the WordPress site remains inaccessible. I've also made the necessary changes in wp-config. I am unable to troubleshoot further, please help

version: '3.1'

services:

  wordpress:
    container_name: frix_wordpress
    build:
      context: .
      dockerfile: Dockerfile
    image: wordpress
    restart: always
    working_dir: /var/www/html
    
    depends_on:
      - db
    ports:
      - 8099:8082
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - .:/var/www/html
  db:
    container_name: frix_db
    image: mysql:8.0
    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:
Share Improve this question asked Mar 27, 2024 at 7:29 csandreas1csandreas1 2063 silver badges11 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Seems that you are forwarding the wrong port. This way, the site should be accessible at http://localhost:8080

    ports:
      - 8080:80

本文标签: migrationMoving existing website to docker