Sign inSign up

sixsq/device-map-cleaner

By sixsq

Updated almost 7 years ago

Image
0

2.2K

sixsq/device-map-cleaner repository overview

PARENT=Name of the dind container launching this one CHILD_APP=Name of the application container making use of --device

Usage:

docker run --rm -d -v /var/run/docker.sock:/var/run/docker.sock --name device_map_cleaner -e PARENT=$(hostname) -e CHILD=$CHILD_APP sixsq/device-map-cleaner

Dockerfile:

FROM docker

COPY watcher.sh /watcher.sh

ENTRYPOINT ["/bin/sh"]
CMD ["/watcher.sh"]

watcher.sh:

#!/bin/bash 

set -x

docker events --filter 'event=die' --filter "container=${PARENT}" | while read line
do     
  echo "PARENT DIED $PARENT"
  docker rm -f $CHILD || echo "cannot find container $CHILD"
  docker rm -f $(hostname)
done

Tag summary

Content type

Image

Digest

Size

59.3 MB

Last updated

almost 7 years ago

docker pull sixsq/device-map-cleaner