Commit 49765107 authored by eric pellegrini's avatar eric pellegrini

Added script for cleaning docker images and contianers after build

parent 215788ca
Pipeline #3795 failed with stages
in 12 minutes 56 seconds
......@@ -203,9 +203,7 @@ clean_docker:
stage: clean
when: always
script:
- docker rm `docker ps -q -f "status=exited"`
- docker images -a --format "{{.Repository}}:{{.Tag}}" | grep _mdanse_ | xargs docker rmi -f
- docker rmi `docker images -q -f "dangling=true"`
- ${CI_PROJECT_DIR}/BuildServer/Docker/clean.sh
tags:
- docker
- sci
......
# Return the docker containers that are exited
exited_containers=`docker ps -q -f "status=exited"`
# If some have been found, remove them
if [ -n "$exited_containers" ]
then
docker rm -f ${exited_containers}
fi
# Return the docker images corresponding to MDANSE
images=`docker images -a --format "{{.Repository}}:{{.Tag}}" | grep _mdanse_`
# If some have been found, remove them
if [ -n "$images" ]
then
docker rmi -f ${images}
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment