I want to remove a file in my docker through docker exec:
user@mongo:~$ docker exec 765511b2869e rm -rf /backup/*.zip
user@mongo:~$ docker exec 765511b2869e ls /backup
-rw-r--r-- 1 root root 40103038 Mar 13 15:26 backup-20170313.zip
Apparently it is not working.
What could be wrong?
This is expected behavior. Characters like * are interpreted by the shell. Thus you need to invoke a shell for them to work.
docker exec 765511b2869e sh -c 'rm -rf /backup/*.zip'