OneBite.Dev - Coding blog in a bite size

How to cd (change directory) inside docker compose

Here is how you can CD into your app inside a running docker compose program that need to be executed

If you need to run a certain task inside a running docker / docker compose that must be executed from a certain folder, here is how:

docker-compose exec -w /usr/src/folder $DOCKER-IMAGE-NAME $TASK-DETAIL-HERE

run exec command with option -w then followed by your folder

In above example I want to cd into folder /usr/src/folder feel free to adjust it!

docker