Update herokuish base image on updates using --pull

Herokuish update fails if existing herokuish is used by other containers,
using docker build --pull will force to update also the base image.

Setting up herokuish (0.3.28) ...
Removing old herokuish image
Failed to remove image (gliderlabs/herokuish): Error response from daemon: conflict: unable to remove repository reference "gliderlabs/herokuish" (must force) - container dbf2298ab5a5 is using its referenced image 7d4a8d661476
Importing herokuish into docker (around 5 minutes)
This commit is contained in:
Edgars Beigarts
2017-04-27 12:39:12 +03:00
parent cc08da9600
commit d468572bf7
2 changed files with 2 additions and 13 deletions

7
deb.mk
View File

@@ -86,16 +86,11 @@ deb-herokuish:
@echo "-> Creating deb files"
@echo "#!/usr/bin/env bash" >> /tmp/tmp/post-install
@echo "sleep 5" >> /tmp/tmp/post-install
@echo "count=\`sudo docker images | grep gliderlabs/herokuish | wc -l\`" >> /tmp/tmp/post-install
@echo 'if [ "$$count" -ne 0 ]; then' >> /tmp/tmp/post-install
@echo " echo 'Removing old herokuish image'" >> /tmp/tmp/post-install
@echo " sudo docker rmi gliderlabs/herokuish" >> /tmp/tmp/post-install
@echo "fi" >> /tmp/tmp/post-install
@echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install
@echo 'if [[ ! -z $${http_proxy+x} ]]; then BUILDARGS="--build-arg http_proxy=$$http_proxy"; fi' >> /tmp/tmp/post-install
@echo 'if [[ ! -z $${https_proxy+x} ]]; then BUILDARGS="$$BUILDARGS --build-arg https_proxy=$$https_proxy"; fi' >> /tmp/tmp/post-install
@echo 'if [[ ! -z $${BUILDARGS+x} ]]; then echo Adding proxy settings to docker build: $$BUILDARGS; fi' >> /tmp/tmp/post-install
@echo 'sudo docker build $$BUILDARGS -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null' >> /tmp/tmp/post-install
@echo 'sudo docker build --pull $$BUILDARGS -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null' >> /tmp/tmp/post-install
@echo "-> Cloning repository"
git clone -q "https://github.com/$(HEROKUISH_REPO_NAME).git" --branch "v$(HEROKUISH_VERSION)" /tmp/tmp/herokuish > /dev/null

View File

@@ -7,14 +7,8 @@ main() {
sleep 5
count=$(sudo docker images | grep -c gliderlabs/herokuish)
if [ "$count" -ne 0 ]; then
echo 'Removing old herokuish image'
sudo docker rmi gliderlabs/herokuish
fi
echo 'Importing herokuish into docker (around 5 minutes)'
sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null
sudo docker build --pull -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null
}
main