WordPress site url issues when using local docker container

admin

Administrator
Staff member
I have ported my wordpress site locally into Docker container, the home page is working fine, here is my folder structure

Code:
/
 -docker-compose.yml
 -src (I have copied my wordpress code from production to this folder)
 -db (It contains the db dump file)

My docker-compose.yml file is like this

Code:
version: '2'

services:

  wordpress:
    image: wordpress
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_NAME: wordpress_wp
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: mypw
    volumes:
      - ./src:/var/www/html

  mysql:
    image: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: mypw
    volumes:
      - ./db/my_wp.sql:/docker-entrypoint-initdb.d/my_wp.sql

Then I ran the command
Code:
docker-compose up
and site is accessible at
Code:
http://localhost:8080/

but the issue is when I click on some menu, it redirects me to my production site i.e.
Code:
http://my-production-site/contact-us

How can I fix the urls automatically?