image-trans-cli
is a command-line tool for managing Docker images. It supports pulling images from a source registry, tagging images, and pushing them to a target registry.
Features
- Pull images from a source registry
- Tag images with a new repository
- Push images to a target registry
Installation
-
Ensure that [Go] and [Docker] are installed on your system.
-
Clone this repository:
git clone https://github.com/Firstnsnd/image-trans-cli.git
cd image-trans-cli
-
Build the project:
make build
Alternatively, if you want to build for Windows:
make build-windows
-
Copy the compiled binary to your PATH, or use it directly in the current directory.
Usage
Create a YAML configuration file (e.g., config.yaml) with the following format:
images:
- nginx:latest
- redis:6
target: my-registry.com
Confirm Permissions
Before pushing images to the target registry, please ensure that you have sufficient permissions to perform the following actions:
- Login to the target registry:
docker login my-registry.com
- Ensure that your account has permissions to push images.
- If using CI/CD tools, make sure the related permissions are configured correctly.
Command Line Usage
Run the tool and specify the configuration file:
./image-trans-cli -c config.yaml
Command Line Arguments
Argument |
Description |
-c, --config |
Path to the YAML configuration file (required) |
-v, --verbose |
Enable verbose output |
--dry-run |
Preview actions without executing them |
Examples
- Process the images from the configuration file:
./image-trans-cli -c ./config.yaml
- Enable verbose output:
./image-trans-cli -c ./config.yaml -v
- Perform a dry run (preview actions):
./image-trans-cli -c ./config.yaml --dry-run
Output Results
After processing is complete, the program will display the results, including statistics of successful and failed image transfers.
Contributing
If you would like to contribute to this project, please create a new branch, make your changes, and submit a Pull Request.
License
This project is licensed under the MIT License. For more details, please see the LICENSE file.