Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用docker运行bot出错 #11

Closed
TheEnd233 opened this issue Aug 22, 2021 · 1 comment
Closed

使用docker运行bot出错 #11

TheEnd233 opened this issue Aug 22, 2021 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@TheEnd233
Copy link

使用的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

@hdcola
Copy link
Contributor

hdcola commented Aug 22, 2021

我看了下你的运行命令,在-v是mount了目录进去
/root/wangwangbot/data
这个目录里应该有一个docker-compose.yaml文件,现在只支持了docker-compose,你想只使用docker是吗?

运行不起来的原因是 /admin 需要读到这个文件才知道有哪里service可以使用

@hdcola hdcola added the help wanted Extra attention is needed label Aug 22, 2021
@HDCodePractice HDCodePractice locked and limited conversation to collaborators Aug 22, 2021
@hdcola hdcola closed this as completed Aug 22, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants