Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

312
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda