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

307
Visualizações
Getting Docker Container Id in Makefile to use in another command

I have a rule in my Makefile. Within this rule I need to manipulate some docker specific things so I need to get the id of the container in a portable way. In addition, I am using Docker Compose. Here is what I have that doesn't work.

a-rule: some deps
    $(shell uuid="$(docker-compose ps -q myService)" docker cp "$$uuid":/a/b/c .)

I receive no errors or output, but I do not get a successful execution.

My goal is to get the uuid of the container that myService is running in and then use that uuid to copy a file from the container to my docker host.

edit: the following works, but I'm still wondering if its possible to do inline variable settings

uuid=$(shell docker-compose ps -q myService)
a-rule: some deps
    docker cp "$(uuid)":/a/b/c .
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I ran into the same problem and realised that makefiles take output from shell variables with the use of $$. So I tried that and this should work for you:

a-rule: some deps
    uuid=$$(docker-compose ps -q myService);\ 
    docker cp "$$uuid":/a/b/c .

Bit late to the party but I hope this helps someone.

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