We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This doesn't seem to work when executing commands on swarm task containers running on a different docker host than docker-crontab.
docker-crontab
below assumes the container is running on the same host
CONTAINERS=$(docker ps --format '{{.Names}}' | grep -E "^[project]_[alias].[0-9]+") for CONTAINER_NAME in $CONTAINERS; do docker exec ${CONTAINER_NAME} [command] done
You could do something like below to get the container name from the docker host running the swarm task.
# deploy {ca,cert,key}.pem as secrets function set_docker_env { export DOCKER_CERT_PATH=/run/secrets export DOCKER_HOST=tcp://$1:2376 export DOCKER_TLS_VERIFY=1 } function unset_docker_env { unset DOCKER_CERT_PATH unset DOCKER_HOST unset DOCKER_TLS_VERIFY } function container_host_from_docker { docker service ps --format '{{.Node}}' --filter 'desired-state=running' $1 | head -n 1 } function container_name_from_docker { set_docker_env $1 docker ps --format '{{.Names}}' | grep -E "^$2.[0-9]+" | head -n 1 } CONTAINER_HOST=$( container_host_from_docker [project]_[alias] ) if [ ! -z "${CONTAINER_HOST// }" ] then CONTAINER_NAME=$( container_name_from_docker $CONTAINER_HOST [project]_[alias] ) docker exec ${CONTAINER_NAME} [command] fi unset_docker_env
The text was updated successfully, but these errors were encountered:
Just noticed this is your to-do's :) I might submit a PR
Sorry, something went wrong.
Looking forward to it.
No branches or pull requests
This doesn't seem to work when executing commands on swarm task containers running on a different docker host than
docker-crontab
.below assumes the container is running on the same host
You could do something like below to get the container name from the docker host running the swarm task.
The text was updated successfully, but these errors were encountered: