https://github.com/pkharsimran/dncheckbashscript
This repository contains a Bash script designed to help users manage and inspect their Docker network environments. The script provides an easy-to-use command-line tool to list all Docker networks on a system and identify whether they are in use by any containers.
https://github.com/pkharsimran/dncheckbashscript
automation bash cli container devops docker docker-networks docker-utilities json linux network-management network-tool open-source script system-administration
Last synced: about 1 month ago
JSON representation
This repository contains a Bash script designed to help users manage and inspect their Docker network environments. The script provides an easy-to-use command-line tool to list all Docker networks on a system and identify whether they are in use by any containers.
- Host: GitHub
- URL: https://github.com/pkharsimran/dncheckbashscript
- Owner: PKHarsimran
- Created: 2023-11-02T06:57:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-02T07:12:22.000Z (over 2 years ago)
- Last Synced: 2023-11-02T08:27:56.091Z (over 2 years ago)
- Topics: automation, bash, cli, container, devops, docker, docker-networks, docker-utilities, json, linux, network-management, network-tool, open-source, script, system-administration
- Language: Shell
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DNCheckBashScript
This repository contains a Bash script designed to help users manage and inspect their Docker network environments. The script provides an easy-to-use command-line tool to list all Docker networks on a system and identify whether they are in use by any containers.
# Features
- **Network Usage Detection:** The script loops through all Docker networks and prints out whether each network is currently being used by running or stopped containers.
- **Default Network Skipping:** It intelligently skips default Docker networks (bridge, host, none) to prevent unnecessary alerts, as these networks are typically used by Docker internally.
- **Container Listing:** For networks that are in use, the script lists all associated container IDs and names, providing a detailed view of the network's utilization.
- **jq** Auto-Installation: The script checks if jq (a lightweight and flexible command-line JSON processor) is installed on the system and attempts to install it if it's missing.
# Prerequisites
- Docker installed and running on your system
- Bash shell environment
- Sudo privileges (if jq is not installed and needs to be automatically installed by the script)
# Usage
1. Clone the repository to your local machine:
git clone https://github.com/PKHarsimran/DNCheckBashScript.git
3. Navigate to the cloned directory:
cd DNCheckBashScript
5. Make the script executable:
chmod +x dncheck.sh
7. Run the script:
./dncheck.sh