1

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:

1 Answer 1

1

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

    ports:
      - 8080:80

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.