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.

  • Setting up Nginx Proxy in Docker using Ansible
  • Cannot validate certificate for ip because it doesn't contain any IP SANs
  • How to use Dockerfile to link main container to a db container?
  • SSH Tunneling to docker container
  • How stable/reliable are the boot2docker and docker-machine IP addresses?
  • deploy after gitlab runner completes build
  • 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?

  • Docker not restarting and building
  • How to see which docker volume is or was being used by which container
  • Change Docker for windows to use another VM besides MobylinuxVM
  • Extend docker container
  • Run Jupyter Notebook in the Background on Docker
  • How do I run the Hetionet v1.0 docker container?
  • 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.