ssh direct into remote docker container works!

This commit is contained in:
Your Name 2025-04-25 22:21:08 +12:00
parent 49a530ba57
commit 1eb2cd9c5c

View File

@ -505,9 +505,9 @@ void interactive_ssh(const std::string & server_name, const std::string & comman
// Execute ssh with server_name and command // Execute ssh with server_name and command
if (command.empty()) if (command.empty())
execlp("ssh", "ssh", login.c_str(), "-p", ssh_port.c_str(), nullptr); execlp("ssh", "ssh", "-tt", login.c_str(), "-p", ssh_port.c_str(), nullptr);
else else
execlp("ssh", "ssh", login.c_str(), "-p", ssh_port.c_str(), command.c_str(), nullptr); execlp("ssh", "ssh", "-tt", login.c_str(), "-p", ssh_port.c_str(), command.c_str(), nullptr);
// If exec returns, it means there was an error // If exec returns, it means there was an error
perror("ssh execution failed"); perror("ssh execution failed");
@ -522,7 +522,7 @@ void service_runner::interactive_ssh_service()
return; return;
} }
std::string command = construct_standard_command_run_cmd("ssh"); std::string command = "/bin/bash -c 'docker exec -it " + m_service_info.service_name + " /bin/bash'";
interactive_ssh(m_server_name, command); interactive_ssh(m_server_name, command);
} }