This docker image runs a inotify service based on Alpine Linux.
If you like to use this image, please use a specific version tag like v1.0.0
or the branches latest
, stable
. The other branches are only temporary and will be deleted after the merge into the other branches.
- Link docker socket into container
-v /var/run/docker.sock:/var/run/docker.sock:ro
- Link one or more directories, which you would like to monitor with inotifywait into the docker container. As example:
-v /var/lib/docker/data/bind/config:/config
. - Set container variable
CONTAINER=<id|name>
, which will be notified. - Define the volume variable to define the container internal paths to the monitored directories.
docker run -d --name inotify -v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /var/lib/docker/data/bind/config:/config \
-e "CONTAINER=bind" -e "VOLUMES=/config" \
pstauffer/inotify:stable
Check out the docker-compose file in the git repo and create your own file. After that run this docker-compose
command.
docker-compse up -d
For debug propose it's possible to pass additional curl options into the container. Just set the environment variable CURL_OPTIONS=-v
.
The default signal is SIGHUP
. This behaviour can be overwritten, if you set the environment variable SIGNAL=<signal>
.
The default inotify events are create,delete,modify,move
. This behaviour can be overwritten, if you set the environment variable INOTIFY_EVENTS=<events>
.
To define your own inotify options, overwrite the variable INOTIFY_OPTONS=<your options>
.
Please be aware that the Docker Socket is mounted inside this Docker Container and with that you can manipulate all containers. So don't expose ports or use this image for external services!
Here are some sample API requests. Just exec the shell and try out the commands. Check out the Docker API Documentation for more calls.
# get all containers
curl --unix-socket /var/run/docker.sock http:/containers/json
# stop a container
curl -X POST --unix-socket /var/run/docker.sock http:/containers/bind/stop
# send a signal to a container
curl -X POST --unix-socket /var/run/docker.sock http:/containers/bind/kill?signal=SIGHUP
This project is licensed under MIT <https://opensource.org/licenses/MIT>
_.