docker-manager.sh is a professional Bash script to manage Docker projects efficiently. It provides commands for Docker login, build, push, pull, and Docker Compose management, all with a simple and consistent interface.
- Initialize project configuration
- Docker login automation
- Build, pull, and push Docker images
- Start, stop, create, close, and recreate containers using Docker Compose
- Supports custom environment files
- Default configuration stored in
docker-manager.json - Colorful, user-friendly terminal interface
- Clone the repository:
git clone https://github.com/mateocallec/docker-manager.sh.git
cd docker-manager.sh- Make the script executable:
chmod +x docker-manager.sh- Ensure dependencies are installed:
- Docker
- Docker Compose
jq(for JSON configuration)
./docker-manager.sh <command> [--env-file <path>]If no command is provided, the script will prompt you for one.
| Commande | Description |
|---|---|
init |
Initialize Docker username and project name |
login |
Log in to Docker registry |
pull |
Pull Docker image |
push |
Push Docker image |
build |
Build Docker image |
create |
Start containers (Docker Compose) |
close |
Stop containers (Docker Compose) |
recreate |
Restart containers (close + create) |
start |
Start stopped containers |
stop |
Stop running containers |
help |
Display help message |
| Option | Description |
|---|---|
--env-file <path> |
Specify a custom .env file for Docker Compose (default: /dev/null) |
The script uses a JSON configuration file: docker-manager.json.
Default configuration:
{
"registry-host": "registry-1.docker.io",
"registry-port": 5000,
"username": "user",
"name": "my-project",
"docker-compose": "docker-compose.yml",
"dockerfile": "Dockerfile"
}Use the init command to customize your username and project name.
- Fork the repository
- Create your feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m 'Add new feature' - Push to the branch:
git push origin feature/my-feature - Open a Pull Request
Please ensure code follows Bash best practices and maintain readability.
This project is licensed under the MIT License. See LICENSE for details.
Matéo Florian Callec GitHub: mateocallec
See CHANGELOG.md for details.