mirror of
https://github.com/m8tin/cis.git
synced 2025-12-06 07:48:26 +01:00
Scripts to determine Docker container settings
This commit is contained in:
4
script/docker/printAllBridgedNetworksWithRange.sh
Executable file
4
script/docker/printAllBridgedNetworksWithRange.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#/bin/bash
|
||||
|
||||
docker network inspect $(docker network ls | grep -F 'bridge' | cut -d' ' -f1) \
|
||||
| jq -r '.[] | .Name + " " + .IPAM.Config[0].Subnet' -
|
||||
23
script/docker/printContainerNamesOfComposition.sh
Executable file
23
script/docker/printContainerNamesOfComposition.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#/bin/bash
|
||||
|
||||
_COMPOSITION_FILE="${1:-./docker-compose.yml}"
|
||||
|
||||
[ -d "${_COMPOSITION_FILE}" ] \
|
||||
&& echo "A valid composition file ('docker-compose.yml') is needed. Given parameter was: ${_COMPOSITION_FILE}" >&2 \
|
||||
&& exit 1
|
||||
|
||||
_DOCKER_COMPOSE_CMD=""
|
||||
|
||||
[ "${_DOCKER_COMPOSE_CMD}" = "" ] \
|
||||
&& docker compose version 2> /dev/null | grep -q version \
|
||||
&& _DOCKER_COMPOSE_CMD="docker compose"
|
||||
|
||||
[ "${_DOCKER_COMPOSE_CMD}" = "" ] \
|
||||
&& docker-compose version 2> /dev/null | grep -q version \
|
||||
&& _DOCKER_COMPOSE_CMD="docker-compose"
|
||||
|
||||
[ "${_DOCKER_COMPOSE_CMD}" = "" ] \
|
||||
&& echo "Command 'docker compose' not found" >&2 \
|
||||
&& exit 1
|
||||
|
||||
${_DOCKER_COMPOSE_CMD} -f "${_COMPOSITION_FILE}" images | tail -n +2 | cut -d' ' -f1
|
||||
Reference in New Issue
Block a user