poc for docker label
This commit is contained in:
20
POC.txt
Normal file
20
POC.txt
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
# docker run -v /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|
||||||
|
curl https://download.docker.com/linux/static/stable/x86_64/docker-26.1.0.tgz --output docker-26.1.0.tgz
|
||||||
|
tar -xzvf docker-26.1.0.tgz
|
||||||
|
./docker/docker ps
|
||||||
|
|
||||||
|
# or
|
||||||
|
# COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
|
||||||
|
# then use `docker` instead of `./docker/docker`
|
||||||
|
|
||||||
|
ids = $(./docker/docker ps --quiet)
|
||||||
|
for id in ids:
|
||||||
|
# key: value
|
||||||
|
labels_dict: dict = $(docker inspect --format='{{json .Config.Labels}}' ${id})
|
||||||
|
for item in labels_dict.items():
|
||||||
|
key, value = item
|
||||||
|
if value.contains(URL):
|
||||||
|
# we got url
|
||||||
|
|
||||||
Reference in New Issue
Block a user