Skip to content

使用docker运行bot出错 #11

@TheEnd233

Description

@TheEnd233

使用的docker命令:
docker run -d --name=wangwangbot --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /root/wangwangbot/data:/data --env-file local.env hdcola/wangwangbot

/root/wangwangbot/local.env文件内容如下:
BOT_TOKEN=我的bot token
ADMINS=我的id

对bot发送/admin发现没有反应,但是发送/start和/help有回应

使用tail /root/wangwangbot/logs/wangwangbot.log 查到以下内容

日志错误信息如下:
compose.config.errors.ComposeFileNotFound:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?

    Supported filenames: docker-compose.yml, docker-compose.yaml, compose.yml, compose.yaml

2021-08-22 01:10:56.357 | ERROR | aiogram.utils.executor:start_polling:323 - Task exception was never retrieved
future: <Task finished name='Task-24' coro=<Dispatcher._process_polling_updates() done, defined at /usr/local/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py:409> exception=ComposeFileNotFound(['docker-compose.yml', 'docker-compose.yaml', 'compose.yml', 'compose.yaml'])>
Traceback (most recent call last):

File "/usr/local/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 417, in _process_polling_updates
for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
│ │ │ │ │ │ └ True
│ │ │ │ │ └ [<aiogram.types.update.Update object at 0x7f6922d849a0>]
│ │ │ │ └ <function Dispatcher.process_updates at 0x7f692165d160>
│ │ │ └ <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f6920e70c70>
│ │ └ <method 'from_iterable' of 'itertools.chain' objects>
│ └ <class 'itertools.chain'>
└ <module 'itertools' (built-in)>
File "/usr/local/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 238, in process_updates
return await asyncio.gather(*tasks)
│ │ └ [<coroutine object Handler.notify at 0x7f691f8b5d40>]
│ └ <function gather at 0x7f69232258b0>
└ <module 'asyncio' from '/usr/local/lib/python3.9/asyncio/init.py'>
File "/usr/local/lib/python3.9/site-packages/aiogram/dispatcher/handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
│ │ │ └ {}
│ │ └ (<aiogram.types.update.Update object at 0x7f6922d849a0>,)
│ └ <bound method Dispatcher.process_update of <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f6920e70c70>>
└ Handler.HandlerObj(handler=<bound method Dispatcher.process_update of <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7...
File "/usr/local/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 259, in process_update
return await self.message_handlers.notify(update.message)
│ │ │ │ └ <aiogram.types.fields.Field object at 0x7f692177aac0>
│ │ │ └ <aiogram.types.update.Update object at 0x7f6922d849a0>
│ │ └ <function Handler.notify at 0x7f692169ea60>
│ └ <aiogram.dispatcher.handler.Handler object at 0x7f6920e705e0>
└ <aiogram.dispatcher.dispatcher.Dispatcher object at 0x7f6920e70c70>
File "/usr/local/lib/python3.9/site-packages/aiogram/dispatcher/handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
│ │ │ └ {}
│ │ └ (<aiogram.types.message.Message object at 0x7f6922d84190>,)
│ └ <function admin_command at 0x7f691f8cab80>
└ Handler.HandlerObj(handler=<function admin_command at 0x7f691f8cab80>, spec=FullArgSpec(args=['message'], varargs=None, varkw...

File "/WangWangBot/WangWangBot/handlers/users/admin.py", line 23, in admin_command
msg, reply_markup = get_top_services_msg()
└ <function get_top_services_msg at 0x7f6922de93a0>

File "/WangWangBot/WangWangBot/handlers/users/admin.py", line 13, in get_top_services_msg
services = docker.check_dir_service_list(Config.DOCKER_COMPOSE_DIR)
│ │ │ └ '/data/'
│ │ └ <class 'WangWangBot.config.Config'>
│ └ <function check_dir_service_list at 0x7f691f8ca550>
└ <module 'WangWangBot.utils.docker' from '/WangWangBot/WangWangBot/utils/docker.py'>

File "/WangWangBot/WangWangBot/utils/docker.py", line 101, in check_dir_service_list
project = get_project(
└ <function get_project at 0x7f691f8c6ca0>

File "/usr/local/lib/python3.9/site-packages/compose/cli/command.py", line 144, in get_project
config_details = config.find(project_dir, config_path, environment, override_dir)
│ │ │ │ │ └ None
│ │ │ │ └ {'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOSTNAME': 'f7410364dcb6', 'BOT_TOKE...
│ │ │ └ None
│ │ └ '/data'
│ └ <function find at 0x7f691ff6a4c0>
└ <module 'compose.config' from '/usr/local/lib/python3.9/site-packages/compose/config/init.py'>
File "/usr/local/lib/python3.9/site-packages/compose/config/config.py", line 320, in find
raise ComposeFileNotFound(SUPPORTED_FILENAMES)
│ └ ['docker-compose.yml', 'docker-compose.yaml', 'compose.yml', 'compose.yaml']
└ <class 'compose.config.errors.ComposeFileNotFound'>

compose.config.errors.ComposeFileNotFound:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?

    Supported filenames: docker-compose.yml, docker-compose.yaml, compose.yml, compose.yaml

Snipaste_2021-08-22_09-37-37

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions