This docker image runs a inotify service based on Alpine Linux.
- 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 docker endpoint
API_ENDPOINT=<container|image|network|etc>
and name 'ENDPOINT_NAME' which will receive theDOCKER_COMMAND=<restart|kill|create|etc>
with parametersDOCKER_PARAMS=<all|name=...|etc>
. DOCKER_PARAMS does not require question mark it will be added if required. - 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 "ENDPOINT_NAME=<notify_this_container>" -e "VOLUMES=/config" \
cina/docker-inotify:latest
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
- Version: for robustness one must specify an API version. Environment variable:
API_VERSION=1.24
- Endpoint: specify the endpoint type which one need to access. See here Environment variable:
API_ENDPOINT=container
- Endpoint name: name or id of the enpoint (image/container/network/etc). Environment variable:
ENDPOINT_NAME=<container name>
- Docker command: specify the command to be executed against the named endpoint. Environment variable:
DOCKER_COMMAND=restart
- Docker parameters: parameter list and values of the command. Environment variable:
DOCKER_PARAMS=
For debug propose it's possible to pass additional curl options into the container. Just set the environment variable CURL_OPTIONS=-s -X POST
.
The default inotify events are create,delete,modify,move
. This behaviour can be overwritten, if you set the environment variable INOTIFY_EVENTS=create,delete,modify,move
.
To define your own inotify options, overwrite the variable INOTIFY_OPTONS=--monitor -r
.
Timer to settle down quick inotify repeated events. SETTLE_DOWN=600
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!
This project is licensed under MIT <http://opensource.org/licenses/MIT>
_.