选择 Docker 镜像
之前测试过 GitHub Proxy 测速 和 NPM 镜像选择,这次把之前在 Docker Hub 镜像测速脚本 的内容在此记录以及更新一下。
其他镜像监控站列在了 Mirror Monitor
最终结果:
| 服务网站 | 下载速度 | 网站说明 |
|---|---|---|
docker.m.ixdev.cn | 63.04 MB/s | 国家 (深圳·前海) 新型互联网交换中心 |
hub2.nat.tf | 2.11 MB/s | 棉花云 |
docker.gh-proxy.com | 9.33 MB/s | 优秀加速镜像 |
ghcr.nju.edu.cn | 61.17 MB/s | 是一组 开源镜像,不适用于 Docker Hub,但适合单独 pull ghcr 使用 |
Home Assistant on Docker 挂载配置目录后无法启动
主要的错误提示是 database is locked。
完整日志如下:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun hacs (no readiness notification)
services-up: info: copying legacy longrun home-assistant (no readiness notification)
[22:38:10] INFO: always_upgrade=false
s6-rc: info: service legacy-services successfully started
2025-12-04 22:38:14.118 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-12-04 22:38:14.132 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration haier which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-12-04 22:38:14.146 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration terncy which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-12-04 22:38:14.163 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration xiaomi_miot which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-12-04 22:38:14.180 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration xiaomi_home which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-12-04 22:38:20.058 ERROR (Recorder) [homeassistant.components.recorder.core] Error during connection setup: (retrying in 3 seconds)
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
self._dbapi_connection = engine.raw_connection()
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 3297, in raw_connection
return self.pool.connect()
~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/components/recorder/pool.py", line 126, in connect
return super().connect()
~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 447, in connect
return _ConnectionFairy._checkout(self, self._fairy)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 1264, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 713, in checkout
rec = pool._do_get()
File "/usr/src/homeassistant/homeassistant/components/recorder/pool.py", line 96, in _do_get
return super()._do_get()
~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 429, in _do_get
c = self._create_connection()
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
return _ConnectionRecord(self)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 675, in __init__
self.__connect()
~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 915, in __connect
)._exec_w_sync_on_first_run(self.dbapi_connection, self)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/event/attr.py", line 483, in _exec_w_sync_on_first_run
self(*args, **kw)
~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/event/attr.py", line 497, in __call__
fn(*args, **kw)
~~^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1378, in _setup_recorder_connection
if database_engine := setup_connection_for_dialect(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self,
^^^^^
...<2 lines>...
not self._completed_first_database_setup,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 452, in setup_connection_for_dialect
execute_on_connection(dbapi_connection, "PRAGMA journal_mode=WAL")
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 307, in execute_on_connection
cursor.execute(statement)
~~~~~~~~~~~~~~^^^^^^^^^^^
sqlite3.OperationalError: database is locked
homeassistant |
The above exception was the direct cause of the following exception:
homeassistant |
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 916, in _setup_recorder
self._setup_connection()
~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1434, in _setup_connection
migration.pre_migrate_schema(self.engine)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/migration.py", line 344, in pre_migrate_schema
inspector = sqlalchemy.inspect(engine)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/inspection.py", line 140, in inspect
ret = reg(subject)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/reflection.py", line 313, in _engine_insp
return Inspector._construct(Inspector._init_engine, bind)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/reflection.py", line 246, in _construct
init(self, bind)
~~~~^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/reflection.py", line 257, in _init_engine
engine.connect().close()
~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 3273, in connect
return self._connection_cls(self)
~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 147, in __init__
Connection._handle_dbapi_exception_noconnection(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
err, dialect, engine
^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 2436, in _handle_dbapi_exception_noconnection
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
self._dbapi_connection = engine.raw_connection()
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 3297, in raw_connection
return self.pool.connect()
~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/components/recorder/pool.py", line 126, in connect
return super().connect()
~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 447, in connect
return _ConnectionFairy._checkout(self, self._fairy)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 1264, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 713, in checkout
rec = pool._do_get()
File "/usr/src/homeassistant/homeassistant/components/recorder/pool.py", line 96, in _do_get
return super()._do_get()
~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 429, in _do_get
c = self._create_connection()
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
return _ConnectionRecord(self)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 675, in __init__
self.__connect()
~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 915, in __connect
)._exec_w_sync_on_first_run(self.dbapi_connection, self)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/event/attr.py", line 483, in _exec_w_sync_on_first_run
self(*args, **kw)
~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/event/attr.py", line 497, in __call__
fn(*args, **kw)
~~^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1378, in _setup_recorder_connection
if database_engine := setup_connection_for_dialect(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self,
^^^^^
...<2 lines>...
not self._completed_first_database_setup,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 452, in setup_connection_for_dialect
execute_on_connection(dbapi_connection, "PRAGMA journal_mode=WAL")
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 307, in execute_on_connection
cursor.execute(statement)
~~~~~~~~~~~~~~^^^^^^^^^^^
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
(Background on this error at: https://sqlalche.me/e/20/e3q8)
2025-12-04 22:38:23.121 ERROR (Recorder) [homeassistant.components.recorder.util] The database at //config/home-assistant_v2.db is corrupt or malformed
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 246, in validate_sqlite_database
run_checks_on_open_db(dbpath, conn.cursor())
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 257, in run_checks_on_open_db
sanity_check_passed = basic_sanity_check(cursor)
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 233, in basic_sanity_check
cursor.execute(
~~~~~~~~~~~~~~^
f"SELECT * FROM {table} LIMIT 1;" # noqa: S608 # not injection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
sqlite3.OperationalError: no such table: states
2025-12-04 22:38:23.123 ERROR (Recorder) [homeassistant.components.recorder.util] The system will rename the corrupt database file //config/home-assistant_v2.db to //config/home-assistant_v2.db.corrupt.2025-12-04T14:38:23.123557+00:00 in order to allow startup to proceed
[22:38:24] INFO: Copied custom_components to config
[22:38:24] INFO: always_install=true
2025-12-04 22:38:25.032 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2025-12-04 22:38:28.159 ERROR (Recorder) [homeassistant.components.recorder.core] Error during connection setup: (retrying in 3 seconds)
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
self._dbapi_connection = engine.raw_connection()
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 3297, in raw_connection
return self.pool.connect()
~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/components/recorder/pool.py", line 126, in connect
return super().connect()
~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 447, in connect
return _ConnectionFairy._checkout(self, self._fairy)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 1264, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 713, in checkout
rec = pool._do_get()
File "/usr/src/homeassistant/homeassistant/components/recorder/pool.py", line 96, in _do_get
return super()._do_get()
~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 429, in _do_get
c = self._create_connection()
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
return _ConnectionRecord(self)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 675, in __init__
self.__connect()
~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 915, in __connect
)._exec_w_sync_on_first_run(self.dbapi_connection, self)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/event/attr.py", line 483, in _exec_w_sync_on_first_run
self(*args, **kw)
~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/event/attr.py", line 497, in __call__
fn(*args, **kw)
~~^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1378, in _setup_recorder_connection
if database_engine := setup_connection_for_dialect(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self,
^^^^^
...<2 lines>...
not self._completed_first_database_setup,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 452, in setup_connection_for_dialect
execute_on_connection(dbapi_connection, "PRAGMA journal_mode=WAL")
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 307, in execute_on_connection
cursor.execute(statement)
~~~~~~~~~~~~~~^^^^^^^^^^^
sqlite3.OperationalError: database is locked
homeassistant |
The above exception was the direct cause of the following exception:
homeassistant |
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 916, in _setup_recorder
self._setup_connection()
~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1434, in _setup_connection
migration.pre_migrate_schema(self.engine)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/migration.py", line 344, in pre_migrate_schema
inspector = sqlalchemy.inspect(engine)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/inspection.py", line 140, in inspect
ret = reg(subject)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/reflection.py", line 313, in _engine_insp
return Inspector._construct(Inspector._init_engine, bind)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/reflection.py", line 246, in _construct
init(self, bind)
~~~~^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/reflection.py", line 257, in _init_engine
engine.connect().close()
~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 3273, in connect
return self._connection_cls(self)
~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 147, in __init__
Connection._handle_dbapi_exception_noconnection(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
err, dialect, engine
^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 2436, in _handle_dbapi_exception_noconnection
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
self._dbapi_connection = engine.raw_connection()
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 3297, in raw_connection
return self.pool.connect()
~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/components/recorder/pool.py", line 126, in connect
return super().connect()
~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 447, in connect
return _ConnectionFairy._checkout(self, self._fairy)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 1264, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 713, in checkout
rec = pool._do_get()
File "/usr/src/homeassistant/homeassistant/components/recorder/pool.py", line 96, in _do_get
return super()._do_get()
~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 429, in _do_get
c = self._create_connection()
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
return _ConnectionRecord(self)
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 675, in __init__
self.__connect()
~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 915, in __connect
)._exec_w_sync_on_first_run(self.dbapi_connection, self)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/event/attr.py", line 483, in _exec_w_sync_on_first_run
self(*args, **kw)
~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/sqlalchemy/event/attr.py", line 497, in __call__
fn(*args, **kw)
~~^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1378, in _setup_recorder_connection
if database_engine := setup_connection_for_dialect(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self,
^^^^^
...<2 lines>...
not self._completed_first_database_setup,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 452, in setup_connection_for_dialect
execute_on_connection(dbapi_connection, "PRAGMA journal_mode=WAL")
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 307, in execute_on_connection
cursor.execute(statement)
~~~~~~~~~~~~~~^^^^^^^^^^^
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
(Background on this error at: https://sqlalche.me/e/20/e3q8)复现方式是把挂载到远程 SMB 位置挂载到容器的 /config 目录,且远程目录是空的。我本打算让容器自己初始化这个目录。但 SMB 和 File Lock 工作地有些不融洽。
那我换成先让容器创建好 config 后,docker cp 出来再重新挂载就好了。