Getting Docker Container Id in Makefile to use in another command Getting Docker Container Id in Makefile to use in another command docker docker

Getting Docker Container Id in Makefile to use in another command


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.