I tried docker container rm container-name > /dev/null
but this still prints Error: No such container: container-name
. I'm trying to silence this error in my bash script.
Asked
Active
Viewed 4,222 times
1 Answers
11
Send stderr to /dev/null:
docker container rm container-name 2> /dev/null

Cyrus
- 84,225
- 14
- 89
- 153
-
thanks, that works, but how do I silence both the error and success at the same time? – Dave Apr 28 '19 at 14:14
-
1Rather, replace `2>` with `&>`. – John Kugelman Apr 28 '19 at 15:52