Commands
Status Command
The status
command provides an overview of the running state of services in a Docker Compose environment. It’s a quick way to check the health and activity of your containers.
Usage
To view the status of an environment using Dock:
dock <environment> status
Examples
Checking the Status of the Development Environment
dock dev status
This command will:
- Display the state of all containers defined in
docker-compose-dev.yml
. - Indicate whether each service is running, stopped, or exited.
Checking the Status of the Production Environment
dock prod status
This command will:
- Use
docker-compose-prod.yml
. - Show the health and activity of all services in the production environment.
Behind the Scenes
The status
command internally maps to the following Docker Compose command:
docker-compose -f <compose-file> ps
Dock simplifies this by automatically selecting the appropriate docker-compose
file based on your configuration.
Output Example
After running dock dev status
, you might see output like this:
| Name | Command | State | Ports |
|--------|-------------------------------|-------|--------------------------|
| app | docker-entrypoint.sh npm ... | Up | 0.0.0.0:3000->3000/tcp |
| db | docker-entrypoint.sh mysqld | Up | 3306/tcp |
| redis | docker-entrypoint.sh redis ...| Up | 6379/tcp |
Tips
- Monitor Services: Use
status
regularly to ensure all services are running as expected. - Debugging Stopped Containers: If a service isn’t running, use
logs
to investigate:dock dev logs
- Combine with Other Commands: Use
status
afterup
orrestart
to confirm that all services are operational.
The status
command provides an at-a-glance view of your Docker Compose services, making it an essential tool for environment management.