mayswind / ezbookkeeping

A lightweight personal bookkeeping app hosted by yourself.
http://ezbookkeeping.mayswind.net
MIT License
118 stars 23 forks source link

The deployment using docker-compose has failed #11

Closed mxdios closed 2 years ago

mxdios commented 2 years ago

docker-compose.yml

version: "2"
services:
  ezbookkeeping:
    image: mayswind/ezbookkeeping
    container_name: ezbookkeeping
    hostname: "ezbookkeeping"
    ports:
      - "5701:8080"
    environment:
      - "EBK_SERVER_DOMAIN=mydomain"
      - "EBK_SERVER_ENABLE_GZIP=true"
      - "EBK_DATABASE_TYPE=mysql"
      - "EBK_DATABASE_HOST=localhost:3306"
      - "EBK_DATABASE_NAME=ezbookkeeping"
      - "EBK_DATABASE_USER=ezbookkeeping"
      - "EBK_DATABASE_PASSWD=password"
      - "EBK_LOG_MODE=file"
      - "EBK_SECURITY_SECRET_KEY=xxxxxxxxx"
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/var/log/ezbookkeeping:/var/log/ezbookkeeping" # 请确保 UID:GID 是 1000:1000

The error log:

2022-10-13 14:37:32 [ERROR] [server.startWebServer] update database table structure failed, because dial tcp 127.0.0.1:3306: connect: connection refused 2022/10/13 14:37:32 Failed to run ezBookkeeping with [/ezbookkeeping/ezbookkeeping server run]: dial tcp 127.0.0.1:3306: connect: connection refused

mayswind commented 2 years ago

please make sure that your ezbookeeping container and mysql container/instance are in the same network,

mxdios commented 2 years ago

@mayswind Yes, a terminal that executes docker-compose up on the same server can connect to mysql

mayswind commented 2 years ago

By default, the network of each docker container is isolated, and if you access "localhost" in ezbookkeeping container, you can only access the port in the current container. You can enter into the ezbookkeeping container and check whether the 3306 port is available.

mxdios commented 2 years ago

@mayswind Thank you very much, the problem was solved, it is for this reason. Thank you