Howto link a prestashop docker to an existing mysql server

I’m using the following Prestashop docker: https://hub.docker.com/r/prestashop/prestashop/

It so happens that I already have a mysql server running on the host, because that was included with the whole DirectAdmin panel.

  • Automatically create docker container and launch python script
  • Docker secure connection with ssh port forwarding
  • Installing rancher 1.6.2 on centos 7
  • devops - Should I create a dedicated 'devops' GitHub user with read permission? [closed]
  • What does “build artifact” mean in the context of a dockerized development environment?
  • Unable to run cygwin in Windows Docker Container
  • The variable DB_SERVER does nothing if I specify localhost or the IP adres of my server. -p 3306:3306 is also not allowed, since that port is already in use.

    How can a Docker container reach the host:3306 mysql server?

  • Error checking TLS connection with Docksal
  • Python: running docker containers with sh and handling UTF-8 decoding errors
  • is there a way to crash a docker container deliberately?
  • OpenShift 3 - Build “cannot be started due to lack of disk space”
  • What is the meaning of “sandbox” in “docker run” command?
  • how to connect to container in docker stack deploy
  • One Solution collect form web for “Howto link a prestashop docker to an existing mysql server”

    If I understand correctly, you have your Prestashop installation inside a container and MySQL server running on the Docker host?

    Unless configured differently, both the container and the host are in the same bridge network.

    Verify that your container is in the bridge network:

    docker inspect <container-name>
    
            "Networks": {
                "bridge": {
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                }
            }
    

    Notice the gateway IP address – this is the address of the docker host inside the bridge network. Use it as a DB_SERVER variable to connect to the MySQL.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.