Docker Exec Path-based Commands
1 min read

Docker Exec Path-based Commands

Docker Exec Path-based Commands

TL;DR: Use sh -c "command with arguments"

I've tried to execute

docker exec <container> du /

in order to see the size used by a container's logs. Unfortunately, this resulted in an error along the lines:

du: C:/Program Files/Git: No such file or directory

This means that my git bash prompt interpreted the / itself. In order to get around this limitation, you need to run:

docker exec <container> sh -c 'du -h /'

HTH,