Skip to content

DB Host Connection Requires host.docker.internal #22

@carlos-reynosa

Description

@carlos-reynosa

I'm on on Linux and using 127.0.0 did not work for me. I had to change the DB host to host.docker.internal. Here is more info:

https://github.com/markshust/docker-magento#linux

Linux
Running Docker on Linux should be pretty straight-forward. Note that you need to run some post install commands as well as installing Docker Compose before continuing. These steps are taken care of automatically with Docker Desktop, but not on Linux.

Copy docker-compose.dev-linux.yml to docker-compose.dev.yml before installing Magento to take advantage of this setup.

The host.docker.internal hostname
The host.docker.internal hostname is used on Docker for Mac/Windows to reference the Docker daemon. On Linux, this hostname does not exist.

This hostname is hard-coded in the php.ini file. To make this hostname resolve, add "host.docker.internal:172.17.0.1" to the app.extra_hosts parameter of docker-compose.yml, replacing 172.17.0.1 with the result of:

docker run --rm alpine ip route | awk 'NR==1 {print $3}'
You must also create a new entry in your /etc/hosts file using the same IP:

172.17.0.1 host.docker.internal

I know it's not exactly about this package but it might help some of the projects users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions