only first w/ onstart was triggered
This commit is contained in:
will Farrell 2017-04-07 23:25:53 -06:00
parent c4a114a31c
commit 76675e99d5
5 changed files with 8 additions and 4 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
*.iml
home_dir
config.json

View File

@ -1,4 +1,4 @@
FROM library/docker:1.13
FROM library/docker:stable
ENV HOME_DIR=/opt/crontab
RUN apk add --no-cache --virtual .run-deps bash jq \

View File

@ -60,7 +60,7 @@ See [`config.sample.json`](https://github.com/willfarrell/docker-crontab/blob/ma
docer build -t crontab .
docker run -d \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /usr/bin/docker:/usr/bin/docker:ro \
-v ./env:/opt/env:ro \
-v /path/to/config/dir:/opt/crontab:rw \
crontab
```

View File

@ -12,4 +12,4 @@ services:
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
# - "/usr/bin/docker:/usr/bin/docker:ro"
- "/Users/willfarrell/Development/docker/crontab/home_dir:/opt/crontab:rw"
- "/Users/willfarrell/Development/docker/docker-crontab/home_dir:/opt/crontab:rw"

View File

@ -12,6 +12,9 @@ CONFIG=${HOME_DIR}/config.json
DOCKER_SOCK=/var/run/docker.sock
CRONTAB_FILE=/etc/crontabs/docker
# Ensure dir exist - in case of volume mapping
mkdir -p ${HOME_DIR}/jobs ${HOME_DIR}/projects
make_image_cmd() {
DOCKERARGS=$(echo ${1} | jq -r .dockerargs)
if [ "${DOCKERARGS}" == "null" ]; then DOCKERARGS=; fi
@ -168,7 +171,7 @@ EOF
cat ${CRONTAB_FILE}
echo "##### run commands with onstart #####"
for COMMAND in "${ONSTART}"; do
for COMMAND in "${ONSTART[@]}"; do
echo "${COMMAND}"
${COMMAND} &
done