import paramiko ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('161.97.93.156', username='carlos', password='Innova1978+*?') cmd = "docker ps -q | xargs -I {} docker inspect {} --format '{{.Name}} | {{index .Config.Labels \"traefik.http.routers.evolution.rule\"}} | {{index .Config.Labels \"traefik.http.routers.evolution-https.rule\"}} | {{index .Config.Image}}'" stdin, stdout, stderr = ssh.exec_command(cmd) print(stdout.read().decode('utf-8')) ssh.close()