Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

312
Visualizações
How to check the status of docker-compose up -d command

When we run docker-compose up-d command to run dockers using docker-compose.yml file, it starts building images or pulling images from the registry. We can see each and every step of this command on the terminal.

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 docker-compose up -d command so that script can let the user (who is using the script) know how much the process has completed or if the docker-compose command has failed due to some reasons.?

Thanks

CODE:

from pexpect import pxssh

session = pxssh.pxssh()
if not session.login(ip_address,<USERNAME>, <PASSWORD>):
    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)
over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

You can view docker-compose logs with following ways

  1. Use docker-compose up -d to start all services in detached mode (-d) (you won't see any logs in detached mode)
  2. Use docker-compose logs -f -t to attach yourself to the logs of all running services, whereas -f means you follow the log output and the -t option gives you nice timestamps (Docs)

credit

over 4 years ago · Santiago Trujillo Relatório

0

What I do to debug small issues is to run:

docker-compose up {service_name} 

This way I get to see the output for an individual service. If the service has a dependency you can always start multiple services like so:

docker-compose up {service_name1} {service_name2}

Additionally I use:

docker-compose logs -f -t {service_name1}

To see the logs of an already running service or alternatively:

docker logs -t -f {container_name}

Notice that the command above needs the container name and not the service name

This way you can make sure service by service that everything works as expected and then you can launch them all in detached mode as suggested in the other answers

over 4 years ago · Santiago Trujillo Relatório

0

I think should use the command docker-compose top, could check the result, It shoul not be empty when the container is running. If the containers is stop or exit or Create, it should return empty

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda