Home > other >  What is wrong with my Laravel docker compose File?
What is wrong with my Laravel docker compose File?

Time:12-08

Can anybody help me with the following? I have a docker-compose file with the following services PHP, Mysql, Redis, and Nginx. The docker-compose file builds without any issues but when I try the URL its not working. The file is down below

version: '3.8'

services:
  php:
    build: ./docker-compose/php-81/build
    image: php-81
    container_name: cumax-php-db
    restart: unless-stopped
    working_dir: /var/www/
    volumes:
      - ./:/var/www
      - ./docker-files/storage/logs/php:/var/www/default/logs
    networks:
      - onboarding
  db:
    image: mysql:8.0
    container_name: cumax-mysql-db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_USER: ${DB_USERNAME}
      SERVICE_TAGS: dev
      SERVICE_NAME: mysql
    volumes:
       -  ./docker-compose/mysql8.0/storage:/var/lib/mysql
    networks:
      - onboarding

  nginx:
    image: nginx:1.17-alpine
    container_name: cumax-nginx
    restart: unless-stopped
    ports:
      - "8070:80"
    volumes:
      - ./:/var/www
      - ./docker-compose/nginx/conf.d:/etc/nginx/conf.d
    networks:
      - onboarding

  redis:
    image: "redis:alpine"
    ports:
        - "6379:6379"
    networks:
      - onboarding

networks:
  onboarding:

CodePudding user response:

On php you don't publish the port.

On the Nginx you only publish to port 8070 on the host.

What is the URL you are using? It should be http://< host >:8070/

And then the nginx should proxy onwards to php.

  • Related