Commands
Down Command
The down command stops a Docker Compose environment and removes containers, networks, and other resources created by the up command.
Usage
To stop an environment using Dock:
dock <environment> d
Examples
Stopping the Development Environment
dock dev d
This command will:
- Stop all running containers defined in
docker-compose-dev.yml. - Clean up associated networks and resources.
Stopping the Production Environment
dock prod d
This command will:
- Use
docker-compose-prod.yml. - Tear down all resources associated with the environment.
Behind the Scenes
The down command internally maps to the following Docker Compose command:
docker-compose -f <compose-file> down
Dock handles selecting the appropriate docker-compose file automatically based on the .dock configuration.
Tips
- Preserve Volumes: By default, the
downcommand removes associated volumes. If you want to retain volumes, use the--volumesflag with the nativedocker-composecommand. - Stop Specific Containers: Use the
rmcommand to remove specific stopped containers without bringing down the entire environment:dock dev rm
The down command is essential for stopping and cleaning up your Docker Compose environments effectively. Combine it with commands like up and logs for a complete workflow.