我的docker-compose.yml 文件如下:
version: '2.0'
services:
db:
image: mariadb:10.5
container_name: seatable-mysql
environment:
- MYSQL_ROOT_PASSWORD=mysql_root # Requested, set the root's password of MySQL service.
- MYSQL_LOG_CONSOLE=true
volumes:
- /home/seatable/mysql-data:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.
networks:
- seatable-net
memcached:
image: memcached:1.5.6
container_name: seatable-memcached
entrypoint: memcached -m 256
networks:
- seatable-net
redis:
image: redis:5.0.7
container_name: seatable-redis
networks:
- seatable-net
seatable:
image: seatable/seatable:latest
container_name: seatable
ports:
- "81:81"
- "443:443" # If https is enabled, cancel the comment.
volumes:
- /home/seatable/seatable-data:/shared # Requested, specifies the path to Seafile data persistent store.
environment:
- DB_HOST=db
- DB_ROOT_PASSWD=mysql_root # Requested, the value shuold be root's password of MySQL service.
- SEATABLE_SERVER_LETSENCRYPT=False # Default is False. Whether to use let's encrypt certificate.
- SEATABLE_SERVER_HOSTNAME=192.111.25.160 # Specifies your host name.
- TIME_ZONE=Asia/Shanghai # Optional, default is UTC. Should be uncomment and set to your local time zone.
depends_on:
- db
- memcached
- redis
networks:
- seatable-net
networks:
seatable-net:
执行:
sudo docker-compose up -d
sudo docker exec -d seatable /shared/seatable/scripts/seatable.sh start
均成功。
但,执行:
sudo docker exec -it seatable /shared/seatable/scripts/seatable.sh superuser
这个命令时,报错如下:
Traceback (most recent call last):
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 213, in ensure_connection
self.connect()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 189, in connect
self.connection = self.get_new_connection(conn_params)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/base.py”, line 274, in get_new_connection
conn = Database.connect(**conn_params)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 353, in init
self.connect()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 633, in connect
self._request_authentication()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 907, in _request_authentication
auth_packet = self._read_packet()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, “Access denied for user ‘root’@‘192.111.25.160’ (using password: YES)”)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “manage.py”, line 10, in
execute_from_command_line(sys.argv)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/init.py”, line 364, in execute_from_command_line
utility.execute()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/init.py”, line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/base.py”, line 283, in run_from_argv
self.execute(*args, **cmd_options)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/base.py”, line 327, in execute
self.check()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/base.py”, line 359, in check
include_deployment_checks=include_deployment_checks,
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/base.py”, line 346, in _run_checks
return checks.run_checks(**kwargs)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/checks/registry.py”, line 81, in run_checks
new_errors = check(app_configs=app_configs)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/checks/model_checks.py”, line 30, in check_all_models
errors.extend(model.check(**kwargs))
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/base.py”, line 1284, in check
errors.extend(cls._check_fields(**kwargs))
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/base.py”, line 1359, in _check_fields
errors.extend(field.check(**kwargs))
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/fields/init.py”, line 913, in check
errors = super(AutoField, self).check(**kwargs)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/fields/init.py”, line 219, in check
errors.extend(self._check_backend_specific_checks(**kwargs))
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/fields/init.py”, line 322, in _check_backend_specific_checks
return connections[db].validation.check_field(self, **kwargs)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/validation.py”, line 49, in check_field
field_type = field.db_type(self.connection)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/fields/init.py”, line 644, in db_type
return connection.data_types[self.get_internal_type()] % data
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/utils/functional.py”, line 35, in get
res = instance.dict[self.name] = self.func(instance)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/base.py”, line 174, in data_types
if self.features.supports_microsecond_precision:
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/utils/functional.py”, line 35, in get
res = instance.dict[self.name] = self.func(instance)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/features.py”, line 53, in supports_microsecond_precision
return self.connection.mysql_version >= (5, 6, 4) and Database.version_info >= (1, 2, 5)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/utils/functional.py”, line 35, in get
res = instance.dict[self.name] = self.func(instance)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/base.py”, line 385, in mysql_version
with self.temporary_connection() as cursor:
File “/usr/lib/python3.7/contextlib.py”, line 112, in enter
return next(self.gen)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 591, in temporary_connection
cursor = self.cursor()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 254, in cursor
return self._cursor()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 229, in _cursor
self.ensure_connection()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 213, in ensure_connection
self.connect()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/utils.py”, line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/utils/six.py”, line 685, in reraise
raise value.with_traceback(tb)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 213, in ensure_connection
self.connect()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/base/base.py”, line 189, in connect
self.connection = self.get_new_connection(conn_params)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/base.py”, line 274, in get_new_connection
conn = Database.connect(**conn_params)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 353, in init
self.connect()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 633, in connect
self._request_authentication()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 907, in _request_authentication
auth_packet = self._read_packet()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
django.db.utils.OperationalError: (1045, “Access denied for user ‘root’@‘192.111.25.160’ (using password: YES)”)
我已确认docker中将mysql的密码时正确的,也进行了远程授权:
grant all privileges on *.* to root@'%' identified by 'mysql_root';
不知我还遗漏什么, 请大神们赐教,谢谢。