docker启动容器报错: (pymysql.err.OperationalError) (2003, “Can‘t connect to MySQL serve
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/impl.py”, line 143, in _do_getreturn self._create_connection()File “/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py”, line 2
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/impl.py”, line 143, in _do_get
return self._create_connection()
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py”, line 256, in _create_connection
return _ConnectionRecord(self)
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py”, line 371, in init
self.__connect()
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py”, line 666, in _connect
pool.logger.debug(“Error on connect(): %s”, e)
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py”, line 72, in exit
with_traceback=exc_tb,
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py”, line 207, in raise
raise exception
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py”, line 661, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/create.py”, line 590, in connect
return dialect.connect(*cargs, **cparams)
File “/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py”, line 584, in connect
return self.dbapi.connect(*cargs, **cparams)
File “/usr/local/lib/python3.7/site-packages/pymysql/connections.py”, line 353, in init
self.connect()
File “/usr/local/lib/python3.7/site-packages/pymysql/connections.py”, line 664, in connect
raise exc
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, “Can’t connect to MySQL server on ‘xxx’ (timed out)”)
请使用直通模式启动容器:
docker run --name xxxx-pre --net host -d xxxxxnsolidation-disposal-pre:1.0.0.930v1
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)