Remove old addon images on infra update

Fixes #329
This commit is contained in:
Girish Ramakrishnan
2015-10-15 12:01:29 -07:00
parent ac9f49dca6
commit adafa449dc
2 changed files with 12 additions and 0 deletions
+7
View File
@@ -14,3 +14,10 @@ MONGODB_IMAGE=cloudron/mongodb:0.7.0
REDIS_IMAGE=cloudron/redis:0.7.0 # if you change this, fix src/addons.js as well
MAIL_IMAGE=cloudron/mail:0.7.0
GRAPHITE_IMAGE=cloudron/graphite:0.7.0
MYSQL_REPO=cloudron/mysql
POSTGRESQL_REPO=cloudron/postgresql
MONGODB_REPO=cloudron/mongodb
REDIS_REPO=cloudron/redis # if you change this, fix src/addons.js as well
MAIL_REPO=cloudron/mail
GRAPHITE_REPO=cloudron/graphite
+5
View File
@@ -37,6 +37,7 @@ graphite_container_id=$(docker run --restart=always -d --name="graphite" \
--read-only -v /tmp -v /run \
"${GRAPHITE_IMAGE}")
echo "Graphite container id: ${graphite_container_id}"
docker images "${GRAPHITE_REPO}" | tail -n +2 | awk '{ print $1 ":" $2 }' | grep -v "${GRAPHITE_IMAGE}" | xargs --no-run-if-empty docker rmi
# mail (MAIL_SMTP_PORT is 2500 in addons.js. used in mailer.js as well)
mail_container_id=$(docker run --restart=always -d --name="mail" \
@@ -48,6 +49,7 @@ mail_container_id=$(docker run --restart=always -d --name="mail" \
--read-only -v /tmp -v /run \
"${MAIL_IMAGE}")
echo "Mail container id: ${mail_container_id}"
docker images "${MAIL_REPO}" | tail -n +2 | awk '{ print $1 ":" $2 }' | grep -v "${MAIL_IMAGE}" | xargs --no-run-if-empty docker rmi
# mysql
mysql_addon_root_password=$(pwgen -1 -s)
@@ -65,6 +67,7 @@ mysql_container_id=$(docker run --restart=always -d --name="mysql" \
--read-only -v /tmp -v /run \
"${MYSQL_IMAGE}")
echo "MySQL container id: ${mysql_container_id}"
docker images "${MYSQL_REPO}" | tail -n +2 | awk '{ print $1 ":" $2 }' | grep -v "${MYSQL_IMAGE}" | xargs --no-run-if-empty docker rmi
# postgresql
postgresql_addon_root_password=$(pwgen -1 -s)
@@ -80,6 +83,7 @@ postgresql_container_id=$(docker run --restart=always -d --name="postgresql" \
--read-only -v /tmp -v /run \
"${POSTGRESQL_IMAGE}")
echo "PostgreSQL container id: ${postgresql_container_id}"
docker images "${POSTGRESQL_REPO}" | tail -n +2 | awk '{ print $1 ":" $2 }' | grep -v "${POSTGRESQL_IMAGE}" | xargs --no-run-if-empty docker rmi
# mongodb
mongodb_addon_root_password=$(pwgen -1 -s)
@@ -95,6 +99,7 @@ mongodb_container_id=$(docker run --restart=always -d --name="mongodb" \
--read-only -v /tmp -v /run \
"${MONGODB_IMAGE}")
echo "Mongodb container id: ${mongodb_container_id}"
docker images "${MONGODB_REPO}" | tail -n +2 | awk '{ print $1 ":" $2 }' | grep -v "${MONGODB_IMAGE}" | xargs --no-run-if-empty docker rmi
# only touch apps in installed state. any other state is just resumed by the taskmanager
if [[ "${infra_version}" == "none" ]]; then