Docker Compose Cheat Sheet/Run one-off command

Starts a fresh container for a one-off task and removes it after exit.

Section: Logs, Exec, and Shell Access

Run one-off command

bash
bash
docker compose run --rm web python manage.py migrate
Explanation

Useful for migrations, tests, or generators.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Logs, Exec, and Shell Access
Show logs
Prints aggregated logs for the project.
OpenIn sheetbashsame section
Follow logs
Streams live logs from services.
OpenIn sheetbashsame section
Tail logs for one service
Shows only recent log lines for a service.
OpenIn sheetbashsame section
Open shell in running service
Executes a shell inside an already-running service container.
OpenIn sheetbashsame section
Open bash in running service
Runs Bash inside the running service container.
OpenIn sheetbashsame section
Show running processes
Displays processes running inside service containers.
OpenIn sheetbashsame section