Cakka
Cakka

Reputation: 342

Failed to setup apache, php , mysql and adminer

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

The apache, php and mysql have been run. I have test it using php codes. But, the adminer can't do login.

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:

Upvotes: 0

Views: 330

Answers (2)

Diego Velez
Diego Velez

Reputation: 1893

You are already using port 8080 on the host, so you need to either proxy pass using apache and dont share the port on adminer, or use a different port

 adminer:
    image: adminer
    ports:
      - 8081:8080

Upvotes: 1

Hansika Weerasena
Hansika Weerasena

Reputation: 3374

Your docker container is named mysql other than the default in adminer db. So you need to add environment variable for your adminer container like below.

adminer:
   image: adminer
   restart: always
   ports:
     - "8080:8080"
   environment:
     - ADMINER_DEFAULT_SERVER=mysql

and links are deprecated remove it. For any other issue please read the docker hub description.

Upvotes: 0

Related Questions