title: How to check the status of docker-compose up -d command
body: <p>When we run <code>docker-compose up-d</code> command to run dockers using <code>docker-compose.yml</code> file, it starts building images or pulling images from the registry. We can see each and every step of this command on the terminal.</p>
  
  <p>I am trying to run this command from a python script. The command starts successfully but after the command, I do not have any idea of how much the process has been completed. Is there any way I can monitor the status of <code>docker-compose up -d</code> command so that script can let the user (who is using the script) know how much the process has completed or if the <code>docker-compose</code> command has failed due to some reasons.?</p>
  
  <p>Thanks</p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>from pexpect import pxssh
  
  session = pxssh.pxssh()
  if not session.login(ip_address,&lt;USERNAME&gt;, &lt;PASSWORD&gt;):
      print("SSH session failed on login")
      print(str(session))
  else:
      print("SSH session login successfull")
      session.sendline("sudo docker-compose up -d")
      session.prompt()
      resp = session.before
      print(resp)
  </code></pre>