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?
Force-remove a running container This command force-removes a running container. $ docker rm --force redis redis. The main process inside the container referenced under the link redis will receive SIGKILL , then the container will be removed.
The docker run command is docker's standard tool to help you start and run your containers. The --rm flag is there to tell the Docker Daemon to clean up the container and remove the file system after the container exits.
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'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With