Run throwaway shell inside Docker Compose service
4 December 2025 (Updated 4 December 2025)
Use the below command to start a Docker Compose service with an interactive bash or sh shell inside a Docker Compose service and then have Docker remove the service as soon as you exit the shell:
docker compose run --rm --entrypoint <bash|sh> <service-name>
Tagged:
Docker Compose recipes