Morris
Morris

Reputation: 775

docker-compose wordpress:latest different default port

I'm trying to set up a dockerised site. It will be a node powered app as the front-end and will use wordpress as a headless cms. I've created a docker-compose.yml file that looks like this:

version: "3.3"

services:
  web:
    build: .
    ports:
      - "3000:80"

  db:
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: wordpress
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress

  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    ports:
      - "8080:80"
    restart: always
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress
      WORDPRESS_DB_NAME: wordpress
volumes:
  db_data: {}

the problem is that wordpress is using port 80. I want to expose the node app on port 80 and have wordpress only accessible on some other port number. I've played around with the wordpress ports mapping but it always seems to sit on port 80:

e.g.

port 80 usage

Upvotes: 0

Views: 603

Answers (1)

Bibek
Bibek

Reputation: 784

If you want to expose node app on port 80 then portyouwanttoexpose:nodecurrentusingport. Here on your command you have done is exposing port 80 to 3000 exactly opposite. I think first use correct ports for node and then try other ports for exposing your wordpress cms

Upvotes: 1

Related Questions