Skip to content

Commit

Permalink
Avoid grep errors in clean-unnecessary-docker (#1089)
Browse files Browse the repository at this point in the history
When `make clean-unnecessary-docker` is run twice, or when there are no docker images tagges as "<none>", make fails because grep fails:

```
Deleting unnecessary container(s)...
Deleting unnecessary image(s)...
make: *** [Makefile:562: clean-unnecessary-docker] Error 1
```

Using `awk` to _also_ search for "<none>", instead of `grep`, solves this issue.
  • Loading branch information
zstadler committed Mar 16, 2021
1 parent fadc4a3 commit 2943e9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ clean-unnecessary-docker:
@echo "Deleting unnecessary container(s)..."
@docker ps -a -q --filter "status=exited" | $(XARGS) docker rm
@echo "Deleting unnecessary image(s)..."
@docker images | grep \<none\> | awk -F" " '{print $$3}' | $(XARGS) docker rmi
@docker images | awk -F" " '/<none>/{print $$3}' | $(XARGS) docker rmi

.PHONY: test-perf-null
test-perf-null: init-dirs
Expand Down

0 comments on commit 2943e9d

Please sign in to comment.