Sign inSign up

annany/guard

By annany

•Updated over 1 year ago

A CLI tool build in Golang to backing up and restoring Postgres databases

Image
0

232

annany/guard repository overview

⁠Guard CLI - Docker Setup

This repository contains the Guard CLI, a Go-based command-line tool packaged as a Docker container.

⁠🚀 Quick Start

⁠1️⃣ Pull the Image from Docker Hub
docker pull annany/guard:latest
⁠2️⃣ Build the Image Locally

If you want to build the image from the source:

docker build -t annany/guard:latest .
⁠3️⃣ Run the Container

To run the container in interactive mode:

docker run -it annany/guard:latest /bin/bash

To run the CLI tool directly:

docker run --rm annany/guard:latest
  • --rm: Removes the container after execution.
⁠4️⃣ Run the Container in the Background (Persistent Mode)

To keep the container running even after exiting:

docker run -dit --name guard-container annany/guard:latest /bin/bash
  • -d: Runs in detached mode (background).
  • -i: Keeps STDIN open.
  • -t: Allocates a TTY session.
  • --name guard-container: Assigns a name to the container.

Reattach later using:

docker exec -it guard-container /bin/bash
⁠5️⃣ Persist Data

To ensure logs and data persist across runs, use volumes:

docker run -dit --name guard-container -v $(pwd)/data:/app/data annany/guard:latest /bin/bash
  • This mounts ./data on your local machine to /app/data inside the container.
⁠6️⃣ Push the Image to Docker Hub

To upload your built image to Docker Hub:

docker login
docker tag annany/guard:latest annany/guard:1.0
docker push annany/guard:1.0
⁠7️⃣ Stop & Remove the Container

To stop the running container:

docker stop guard-container

To remove it completely:

docker rm guard-container

⁠🛠 Troubleshooting

  • Check container logs:
    docker logs guard-container
    
  • List all running containers:
    docker ps
    
  • List all containers (including stopped ones):
    docker ps -a
    

⁠📜 License

This project is licensed under the MIT License.

Tag summary

Content type

Image

Digest

sha256:f4fa069c5…

Size

14.7 MB

Last updated

over 1 year ago

docker pull annany/guard