Wrapper for docker compose commands in your project.
First, install required dependencies on your system:
- Docker
- Docker Compose v2
Then, install DockerC with the following command:
/bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/matiboux/dockerc/HEAD/install.sh)"
# Usage: /bin/sh -c "$(cat install.sh)" -- [--help] [--install-dir <dir>] [tag]
Take a look at the install.sh script to see what it does.
If you get a cURL error, check the following:
-
cURL error
22
: Requested tag was not found. Verify your network and that the tag exists. -
cURL error
23
: Failed to install DockerC. Verify your permissions in the install directory or try to run the command again withsudo
.sudo /bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/matiboux/dockerc/HEAD/install.sh)"
DockerC simplifies the use of docker compose commands in your project.
Imagine you have a project with one or more docker compose files:
my-project/
βββ ...
βββ docker/
β βββ docker-compose-train.yml
β βββ docker-compose-train.gpu.yml
βββ docker-compose.yml
βββ docker-compose.override.yml
βββ docker-compose.prod.yml
βββ ...
You can now run your docker compose commands with DockerC:
# The default context uses the override file if it exists!
dockerc # -> docker compose -f docker-compose.yml -f docker-compose.override.yml up -d
# Use "-" to use the default context with arguments.
dockerc - # -> docker compose -f docker-compose.yml -f docker-compose.override.yml up -d
dockerc - down # -> docker compose -f docker-compose.yml -f docker-compose.override.yml down
dockerc - exec app sh # -> docker compose -f docker-compose.yml -f docker-compose.override.yml exec app bash
# Use "--" to use docker compose without file arguments.
dockerc -- # -> docker compose up -d
dockerc -- start # -> docker compose start
# The dev context works like the default context as long as no matching file is found.
dockerc dev # -> docker compose -f docker-compose.yml -f docker-compose.override.yml up -d
dockerc dev logs # -> docker compose -f docker-compose.yml -f docker-compose.override.yml logs
dockerc prod # -> docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
dockerc prod restart # -> docker compose -f docker-compose.yml -f docker-compose.prod.yml restart
dockerc train # -> docker compose -f docker/docker-compose-train.yml up -d
dockerc train stop # -> docker compose -f docker/docker-compose-train.yml stop
dockerc train.gpu # -> docker compose -f docker/docker-compose-train.yml -f docker/docker-compose-train.gpu.yml up -d
dockerc train.gpu ps # -> docker compose -f docker/docker-compose-train.yml -f docker/docker-compose-train.gpu.yml ps
Copyright (c) 2023 Matiboux (matiboux.me)
Licensed under the MIT License. You can see a copy in the LICENSE file.
Disclaimer:
Docker is a trademark of Docker, Inc.
The license of this project does not grant any rights to use the Docker name, logo, or trademarks.
This project is not affiliated with Docker, Inc. or any of its related projects.