1

I´m using JSch to run a docker command, but it´s not working, and it´s not returning anything.

    ChannelExec channel = (ChannelExec) session.openChannel("exec");
    BufferedReader in = new BufferedReader(new InputStreamReader(channel.getInputStream()));
    channel.setCommand("docker ps -a");
    channel.connect();



 String msg = null;
        while ((msg = in.readLine()) != null) {
            System.out.println(msg);
        }

If I run a bash command as 'pwd' or 'ls -l' works fine.

I can expect that the docker command will work on ChannelExec and not ChannelShell or any other type?

session.openChannel("exec")

Regards.

paul
  • 12,873
  • 23
  • 91
  • 153

0 Answers0