Fix docker discovery with sudo fallback

This commit is contained in:
2026-02-07 22:20:42 +03:00
parent 2a6f8a9c54
commit 441bafa116
3 changed files with 21 additions and 28 deletions

View File

@@ -2,7 +2,7 @@ import json
from aiogram import F
from aiogram.types import CallbackQuery, InlineKeyboardMarkup, InlineKeyboardButton
from app import dp, ADMIN_ID
from services.runner import run_cmd
from services.docker import docker_cmd
from state import DOCKER_MAP
from handlers.backup import cmd_backup_status
@@ -17,7 +17,7 @@ async def docker_callback(cb: CallbackQuery):
if action == "restart":
await cb.answer("Restarting…")
rc, out = await run_cmd(["sudo", "docker", "restart", real])
rc, out = await docker_cmd(["restart", real])
await cb.message.answer(
f"🔄 **{alias} restarted**\n```{out}```",
@@ -26,9 +26,7 @@ async def docker_callback(cb: CallbackQuery):
elif action == "logs":
await cb.answer("Loading logs…")
rc, out = await run_cmd(
["sudo", "docker", "logs", "--tail", "80", real]
)
rc, out = await docker_cmd(["logs", "--tail", "80", real])
await cb.message.answer(
f"📜 **Logs: {alias}**\n```{out}```",