Docker Community Forums

Share and learn in the Docker community.

Failed to setup apache, php , mysql and adminer


#1

I am trying to use docker and setup apache, php, mysql and adminer using this docker-compose.yml

version: "3.2"
services:
  php:
    image: php:latest
    build: './php/'
    networks:
      - backend
    volumes:
      - ./public_html/:/var/www/html/
  apache:
    image: httpd:latest
    build: './apache/'
    depends_on:
      - php
      - mysql
    networks:
      - frontend
      - backend
    ports:
      - "8000:80"
    volumes:
      - ./public_html/:/var/www/html/
  mysql:
    image: mysql:latest
    networks:
      - backend
    environment:
      - MYSQL_ROOT_PASSWORD=admin
  adminer:
    image: adminer
    restart: always
    links:
      - mysql
    ports:
      - "8080:8080"
networks:
  frontend:
  backend:

But, it is failed.

The adminer work, but I can’t login using
username : root
password : admin

And when I try to to open http://localhost:80 it is loading the default php apache on my osx (osx 10.11) , it can’t open the index.php file that I’ve prepared in docker.

Please tell me know, what is wrong from my configuration.

Thank you


(Martin Terp) #2

Hi, here you mix the php with apache, but they dont work together, for that you need a container running apache with php.

Try and remove the “php” part, and replace the apache image with: php:7.3.0-apache-stretch