1
0
mirror of https://github.com/stucki/docker-lineageos synced 2025-01-09 17:39:47 -05:00

After successful build, delete existing containers

This commit is contained in:
Michael Stucki 2015-04-03 20:29:37 +02:00
parent a352f54870
commit 000fe51fef
2 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased][unreleased]
### Fixed
- Fix check if build is needed
- After successful build, delete existing containers
## [0.3.0] - 2015-03-31
### Added

6
run.sh
View File

@ -22,6 +22,12 @@ if [ $? -ne 0 ]; then
elif [[ $FORCE_BUILD = 1 ]] || ! echo "$IMAGE_EXISTS" | grep -q "$TAG"; then
echo "Building Docker image $REPOSITORY:$TAG..."
docker build -t $REPOSITORY:$TAG .
# After successful build, delete existing containers
IS_EXISTING=$(docker inspect -f '{{.Id}}' $CONTAINER 2>/dev/null)
if [[ -n "$IS_EXISTING" ]]; then
docker rm $CONTAINER
fi
fi
# With the given name $CONTAINER, reconnect to running container, start