Examples
Usage Examples
Get a hands-on understanding of Dock with these practical usage examples. These examples demonstrate how Dock simplifies Docker Compose workflows.
Starting an Environment
To start a development environment:
dock dev u
This command:
- Uses
docker-compose-dev.yml
. - Brings up the containers in detached mode.
Stopping an Environment
To stop a production environment:
dock prod d
This command:
- Stops all services defined in
docker-compose-prod.yml
. - Removes associated networks and resources.
Building and Starting an Environment
To rebuild and start a test environment:
dock test b
This command:
- Builds the services in
docker-compose-test.yml
. - Starts the environment in detached mode.
Restarting Services
To restart services in a development environment:
dock dev r
This command:
- Stops and then restarts all services in
docker-compose-dev.yml
.
Viewing Logs
To follow logs in real time for a specific environment:
dock dev logs
Checking Status
To check the status of services in an environment:
dock dev status
This command displays the state of all containers, including their ports and health.
Removing Stopped Containers
To clean up stopped containers in an environment:
dock dev rm
Stopping All Containers
To stop all running containers across all environments:
dock any_env stop_all
Purging Docker Data
To remove all Docker containers, images, volumes, and networks:
dock any_env purge
These examples illustrate the simplicity and power of Dock, making Docker Compose workflows efficient and easy to manage.