Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Set of scripts to get useful information within docker containers.

License

NotificationsYou must be signed in to change notification settings

felipecrs/docker-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Set of scripts to get useful information within docker containers.

Usage

Allget_ scripts will print the requested information tostdout.

Allis_ scripts will return exit code0 if the condition is met, and1 otherwise.

Any unexpected behavior will be printed tostderr.

If theVERBOSE environment variable is set totrue, the scripts will print additional information tostderr.

Additionally, you can set theDEBUG environment variable totrue to print debug information tostderr.

Installation

You can add the scripts to your images like this:

FROM alpineARG DOCKER_SCRIPTS_VERSION=0.2.0ADD https://github.com/felipecrs/docker-scripts.git#v${DOCKER_SCRIPTS_VERSION}:scripts /opt/docker-scripts

And then, you can invoke any script calling it from/opt/docker-scripts:

docker run --rm --cpus 2 my-image /opt/docker-scripts/get_cpus.sh2

get_cpus.sh

In a system with cgroup v2:

cat scripts/get_cpus.sh| docker run --rm -i -e VERBOSE=true alpine shVERBOSE(get_cpus.sh): cgroup v2 detected.VERBOSE(get_cpus.sh): No CPU limits set.VERBOSE(get_cpus.sh): CPUs:16cat scripts/get_cpus.sh| docker run --rm -i -e VERBOSE=true --cpus 2 alpine shVERBOSE(get_cpus.sh): cgroup v2 detected.VERBOSE(get_cpus.sh): CPUs:2cat scripts/get_cpus.sh| docker run --rm -i -e VERBOSE=true --cpus 1.5 alpine shVERBOSE(get_cpus.sh): cgroup v2 detected.VERBOSE(get_cpus.sh): CPUs:1cat scripts/get_cpus.sh| docker run --rm -i -e VERBOSE=true --cpus 0.5 alpine shVERBOSE(get_cpus.sh): cgroup v2 detected.VERBOSE(get_cpus.sh): CPUs:1

Another system with cgroup v1:

cat scripts/get_cpus.sh| docker run --rm -i -e VERBOSE=true alpine shVERBOSE(get_cpus.sh): cgroup v1 detected.VERBOSE(get_cpus.sh): No CPU limits set.VERBOSE(get_cpus.sh): CPUs:8cat scripts/get_cpus.sh| docker run --rm -i -e VERBOSE=true --cpus 2 alpine shVERBOSE(get_cpus.sh): cgroup v1 detected.VERBOSE(get_cpus.sh): CPUs:2cat scripts/get_cpus.sh| docker run --rm -i -e VERBOSE=true --cpus 1.5 alpine shVERBOSE(get_cpus.sh): cgroup v1 detected.VERBOSE(get_cpus.sh): CPUs:1cat scripts/get_cpus.sh| docker run --rm -i -e VERBOSE=true --cpus 0.5 alpine shVERBOSE(get_cpus.sh): cgroup v1 detected.VERBOSE(get_cpus.sh): CPUs:1

get_memory.sh

In a system with cgroup v2:

cat scripts/get_memory.sh| docker run --rm -i -e VERBOSE=true alpine shVERBOSE(get_memory.sh): cgroup v2 detected.VERBOSE(get_memory.sh): No memory limits set.VERBOSE(get_memory.sh): Memory (MB):15996cat scripts/get_memory.sh| docker run --rm -i -e VERBOSE=true --memory 1g alpine shVERBOSE(get_memory.sh): cgroup v2 detected.VERBOSE(get_memory.sh): Memory (MB):1024

Another system with cgroup v1:

cat scripts/get_memory.sh| docker run --rm -i -e VERBOSE=true alpine shVERBOSE(get_memory.sh): cgroup v1 detected.VERBOSE(get_memory.sh): No memory limits set.Memory (MB):32092cat scripts/get_memory.sh| docker run --rm -i -e VERBOSE=true --memory 1g alpine shVERBOSE(get_memory.sh): cgroup v1 detected.VERBOSE(get_memory.sh): Memory (MB):1024

is_privileged.sh

cat scripts/is_privileged.sh| docker run --rm -i -e VERBOSE=true alpine shVERBOSE(is_privileged.sh): Container is not running in privileged mode.echo$?1cat scripts/is_privileged.sh| docker run --rm -i -e VERBOSE=true --privileged alpine shVERBOSE(is_privileged.sh): Container is running in privileged mode.echo$?0

About

Set of scripts to get useful information within docker containers.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages


[8]ページ先頭

©2009-2025 Movatter.jp