nuxsmin / docker-syspass

Docker stuff for running sysPass on Docker
GNU General Public License v3.0
39 stars 21 forks source link

Docker doesn't connect to remote database #15

Closed jerheij closed 6 years ago

jerheij commented 6 years ago

I am trying to setup a docker instance of syspass and then use my old configuration from the non-docker installation (/var/www/syspass/config) as the config folder on the docker app server.

When I start up the server it runs and I can connect to the configured SSL port. But I get the following error:

Error 1045: SQLSTATE[HY000] [1045] Access denied for user 'syspass_user'@'192.168.199.235' (using password: YES)

My docker-compose.yml file: (with the correct indents of course)

version: '2'
services:
  app:
    container_name: syspass-app
    image: nuxsmin/docker-syspass:latest
    restart: always
    ports:
      - "192.168.199.235:8081:80"
      - "192.168.199.235:9081:443"
    volumes:
      - /opt/syspass/config:/var/www/html/sysPass/config
      - /opt/syspass/backup:/var/www/html/sysPass/backup

My config.xml:

<dbHost>192.168.199.251</dbHost>
<dbName>syspass</dbName>
<dbPass>supersecretpw</dbPass>
<dbPort>3306</dbPort>
<dbSocket></dbSocket>
<dbUser>syspass_user</dbUser>
nuxsmin commented 6 years ago

It seems that, although you're mapping the external ports into the container, the sysPass app container will connect to the database through the internal network address, unless you set an external database, did you?

jerheij commented 6 years ago

I did, I think my problem was that I forgot to allow the docker IP on the database. I did that and now it seems to work. I also have all my passwords etc back.

The message made me think the outgoing IP was the docker IP, but it was MySQL saying the IP is not allowed with that user and database.

Thanks for the quick reply!