Using the dockerp-Lamp

Asked

Viewed 33 times

0

I’m trying to user the Docker-Lamp

But every time I try to access phpmyadmin with root login and password 123, it gives the following message

Não é possível fazer login no servidor MySQL

 mysqli_real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known

 mysqli_real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known

How do I use phpmyadmin, the bank if I want to use from a Workbench?

I’m on Linux Mint 19

On the Docker-Compose.yml I left so:

version: "3.1"
services:
    www:
        build: .
        ports: 
            - "80:80"
        volumes:
            - ./www:/var/www/html/
        links:
            - db
        networks:
            - default
    db:
        image: mysql:8.0
        ports: 
            - "3306:3306"
        command: --default-authentication-plugin=mysql_native_password
        environment:
            MYSQL_PASSWORD: 123
            MYSQL_ROOT_PASSWORD: 123
        volumes:
            - ./dump:/docker-entrypoint-initdb.d
            - ./conf:/etc/mysql/conf.d
            - persistent:/var/lib/mysql
        networks:
            - default
    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        links: 
            - db:db
        ports:
            - 8000:80
        environment:            
            MYSQL_PASSWORD: 123
            MYSQL_ROOT_PASSWORD: 123
volumes:
    persistent:

1 answer

0

Try this

version: "3.1"
services:
    www:
        build: .
        ports: 
            - "80:80"
        volumes:
            - ./www:/var/www/html/
        links:
            - db

    db:
        image: mysql:8.0
        ports: 
            - "3306:3306"
        command: --default-authentication-plugin=mysql_native_password
        environment:
            MYSQL_PASSWORD: 123
            MYSQL_ROOT_PASSWORD: 123
        volumes:
            - ./dump:/docker-entrypoint-initdb.d
            - ./conf:/etc/mysql/conf.d
            - persistent:/var/lib/mysql

        environment:
            MYSQL_ROOT_PASSWORD: 123
            MYSQL_DATABASE: bancopadrao
            MYSQL_USER: outrouser
            MYSQL_PASSWORD: outrasenha

     phpmyadmin:
            image: phpmyadmin/phpmyadmin
            links: 
                - db:db
            ports:
                - 8000:80
            environment:
                PMA_HOST: mysql
                PMA_PORT: 3306
volumes:
    persistent:

To be able to access via Workbench you must expose database port 'db' as you are already doing on port 3306, just pass the database and user and password defined.

This example of a project of mine can help you https://github.com/ggbr/lamp/blob/master/docker-compose.yml

Browser other questions tagged

You are not signed in. Login or sign up in order to post.