harbur / captain

Captain - Convert your Git workflow to Docker :whale: containers
MIT License
767 stars 51 forks source link

Use docker inspect to check image existence instead of docker images API #12

Closed dkapanidis closed 9 years ago

dkapanidis commented 9 years ago

During captain build, in order to check if image already exists a call to 'docker image' is made. To improve response time the call should ask to filter by image name.

dkapanidis commented 9 years ago

Improved captain build time considerably:

Version 0.1.1

➜  captain git:(master) time captain build
[CAPTAIN] Skipping build of harbur/captain:af6c60b - image is already built
[CAPTAIN] Tagging image harbur/captain:af6c60b as harbur/captain:latest
[CAPTAIN] Tagging image harbur/captain:af6c60b as harbur/captain:master
[CAPTAIN] Skipping build of harbur/captain-test:af6c60b - image is already built
[CAPTAIN] Tagging image harbur/captain-test:af6c60b as harbur/captain-test:latest
[CAPTAIN] Tagging image harbur/captain-test:af6c60b as harbur/captain-test:master
captain build  0,02s user 0,04s system 2% cpu 3,104 total

3 seconds to skip builds of two images.

With applied change:

➜  captain git:(master) time captain build                                                                                              
[CAPTAIN] Skipping build of harbur/captain:af6c60b - image is already built
[CAPTAIN] Tagging image harbur/captain:af6c60b as harbur/captain:latest
[CAPTAIN] Tagging image harbur/captain:af6c60b as harbur/captain:master
[CAPTAIN] Skipping build of harbur/captain-test:af6c60b - image is already built
[CAPTAIN] Tagging image harbur/captain-test:af6c60b as harbur/captain-test:latest
[CAPTAIN] Tagging image harbur/captain-test:af6c60b as harbur/captain-test:master
captain build  0,03s user 0,01s system 18% cpu 0,208 total

0.2 seconds to skip builds of two images.