Replies: 1 comment
-
| 
         Finally found a way to run this. Took some trial and error, and had to read a bit about Docker networking. But this is a working setup if anyone else is looking for something similar: version: "3.9"
services:
  webserver:
    container_name: webserver
    image: "jc21/nginx-proxy-manager:latest"
    ports:
      - 80:80 # Public HTTP Port
      - 81:81 # Admin Web Port
      - 443:443 # Public HTTPS Port
    volumes:
      - src:/data
      - certs:/etc/letsencrypt
    #Ensure proxy manager survives crashes
    restart: unless-stopped
    networks:
      - default
  db:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${WORDPRESS_DB_NAME}
      MYSQL_USER: ${WORDPRESS_DB_USER}
      MYSQL_PASSWORD: ${WORDPRESS_DB_PASSWORD}
    volumes:
      - db_data:/config
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "--silent"]
    networks:
      - internal
  wordpress:
    image: wordpress:latest
    container_name: wordpress
    depends_on:
      - db
    restart: always
    build:
      context: .
      dockerfile: WordPress.Dockerfile
    command: /bin/bash -c "set -ex; composer update --prefer-dist; exec docker-entrypoint.sh apache2-foreground"
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: ${WORDPRESS_DB_USER}
      WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD}
      WORDPRESS_DB_NAME: ${WORDPRESS_DB_NAME}
      WORDPRESS_TITLE: ${WORDPRESS_SITE_TITLE}
      WORDPRESS_ADMIN_EMAIL: ${ADMIN_EMAIL}
      WORDPRESS_CONFIG_EXTRA: |
        define( 'WPSITEURL', ${WORDPRESS_SITE_URL} );
        define( 'WPHOME', ${WORDPRESS_SITE_URL} );
    expose:
      - ${WORDPRESS_PORT}
    volumes:
      - wp_data:/var/www/html
    networks:
      - default
      - internal
networks:
  default:
    external:
      name: proxy-network
  internal:
    driver: bridge
volumes:
  db_data:
    name: headless_db_data
  wp_data:
    name: headless_wp_data
  src:
    name: headless_src
  certs:
    name: headless_certs
  backups:
    name: headless_backupsThe trick is to use an internal bridge-network for the different containers that need to communicate internally, and then setup the default network as external and then only use this for containers that needs to be exposed externally. For the full context, my  # syntax=docker/dockerfile:1.4.3
FROM wordpress:latest
# install Composer
COPY --from=composer /usr/bin/composer /usr/bin/composer
# update Composer to latest version
RUN composer self-update
COPY . .
EXPOSE 80
 | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am struggling to set up NGINX Proxy Manager with WordPress.
Is there any way to run both NGINX Proxy Manager and WordPress services in the same docker-compose file or can anyone explain why this is not working?
I would expect to be able to proxy the WordPress service from the NGINX Proxy Manager admin but I can't seem to access WordPress by referencing the service name when setting up the proxy host.
If I setup other services inside my docker-compose file I can access and proxy the service just fine.
(see below docker-compose file - I can proxy
duplicatiwithout issues).Is this because of a conflict as both NGINX-proxy-manager is using 80/tcp and is there any workaround for this?
I am running the setup on Oracle-cloud and have my instance restricted only publicly to expose ports 80,443 and 81.
Example setup (this is not working):
Beta Was this translation helpful? Give feedback.
All reactions