• 5 Subscribers
  • 114 Views
0

may be somebody know how to resolve my issue?

If I use my existing app with wp-content and existing db, every time I've get redirected to the localhost:80 port. How to launch it at another port, maybe 8000 for example?

I have a Wordpress app Dockerfile with next lines:

FROM wordpress:latest

COPY ./src /var/www/html

ENV WORDPRESS_DB_PASSWORD mypass
ENV WORDPRESS_DB_NAME mydb
ENV WORDPRESS_DB_HOST mysql:3306

MySQL Dockerfile with existing db dump:

FROM mariadb:10.1.20

COPY dump/dump.sql /docker-entrypoint-initdb.d

ENV MYSQL_ROOT_PASSWORD mypass

CMD ["mysqld"]

And docker-compose.yml with that:

version: '2'

services:
  mysql:
    build: mysql/
    restart: always
    volumes:
      - db_data:/var/lib/mysql
  wordpress:
    depends_on:
      - mysql
    build: wpapp/
    ports:
      - 8000:80
    restart: always
volumes:
  db_data:

Thanks for help everyone!


2 answers in total

1
IanEdington Posted at 2017-01-13 14:25:26Z

Override the database siteurl and homeurl vales with these lines in you wp-config.php:

define('WP_HOME', 'http://localhost:8000/');
define('WP_SITEURL', 'http://localhost:8000/');
0
Vadim Shvetsov Posted at 2017-01-13 08:31:02Z

After many tests I can recap how to solve this issue.

  1. We need to change option_value of 2 rows in db table wp_options with option_names siteurl and home to http://localhost:8000 in this case.

  2. We need to trigger dockers build to mysql container with volume.

    docker-compose down -v

    optional for clean docker cache

    docker rm $(docker ps -aq)

    docker volume rm $(docker volume ls -q)

    docker rmi $(docker images -q)

    this is not optional ofcourse

    docker-compose up -d --build

  3. The main thing is to clean browser cache manually, because it invokes redirect faster then cache clean if we use CMD + R for example in Safari and it seems like nothing is working after changes.

Answer this questsion