Created
November 29, 2021 22:32
-
-
Save dberardo-com/267ee5f6bb21bbc17630a2d4a7a9057a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.7" | |
x-default-opts: &default-opts | |
logging: | |
options: | |
max-size: "1m" | |
secrets: | |
pub_key: | |
external: true | |
private_key: | |
external: true | |
services: | |
plugin-vieux: | |
<<: *default-opts | |
image: mavenugo/swarm-exec:17.03.0-ce | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
- /etc/:/etc/.ssh/ | |
secrets: | |
- pub_key | |
- private_key | |
environment: | |
- PUB_KEY=/run/secrets/pub_key | |
- PRIVATE_KEY=/run/secrets/private_key | |
- SSHFS_HOST=myuser@remote_sshfs_host/path # change this to point to your remote storage | |
command: > | |
sh -c ' | |
cat $$PUB_KEY > /etc/.ssh/id_rsa_sshfs.pub && | |
chmod 600 /etc/.ssh/id_rsa_sshfs.pub && | |
cat $$PRIVATE_KEY > /etc/.ssh/id_rsa && | |
chmod 600 /etc/.ssh/id_rsa && | |
docker plugin install --grant-all-permissions vieux/sshfs DEBUG=1 sshkey.source=/etc/.ssh || echo "plugin already installed" && | |
echo $SSHFS_HOST && | |
docker volume create -d vieux/sshfs:latest -o sshcmd=$SSHFS_HOST SSHFS_TEST && | |
docker run --rm -v SSHFS_TEST:/tmp alpine ls -l /tmp | |
docker volume rm SSHFS_TEST | |
' | |
deploy: | |
mode: global | |
restart_policy: | |
condition: on-failure | |
delay: 10s | |
max_attempts: 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment