-
Notifications
You must be signed in to change notification settings - Fork 0
Docker
Vlad edited this page May 22, 2022
·
6 revisions
Initialize swarm
docker swarm init
docker node update --label-add role=unifi $(hostname)
Remove all services
for i in $(docker service ls -q); do docker service rm $i; done
From STDIN
echo 'xxxxxx' | ssh rhea docker secret create my_secret_token_v1 -
From file
ssh rhea docker secret create webhook_v1.yml - < ./webhook.yml
All at once
for s in ./swarm/secrets/*; do ssh host docker secret create "$(basename "$s")" /dev/stdin < "$s"; done
Rotate config/secret
ssh rhea docker config create config_v2 - < ./config.yml
ssh rhea docker secret create secret_v2 - < ./secret.yml
services:
service:
configs:
- source: config_v2
target: /etc/config.yml
secrets:
- source: secret_v2
target: /secret.yml
configs:
config_v2:
external: true
secrets:
secret_v2:
external: true
DOCKER_HOST='ssh://user@host' docker ps -a
docker -H ssh://prometheus stack deploy --prune --compose-file ./swarm/prometheus.yml prometheus
docker context create prometheus --docker "host=ssh://prometheus"
docker --context prometheus ps
docker service ls
docker service ps <service>
docker service inspect <service>
docker inspect <task>
docker inspect <container>
docker logs <container>
# Uses https://github.com/docker/buildx/
# Thanks to https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/getting-started-with-docker-for-arm-on-linux
export DOCKER_CLI_EXPERIMENTAL=enabled
# https://hub.docker.com/r/docker/binfmt/tags
docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
docker buildx create --name multi_arch_builder --use
docker buildx build --rm --pull --push --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 -t vladgh/minidlna:latest -t vladgh/minidlna:0 -t vladgh/minidlna:0.3 -t vladgh/minidlna:0.3.10 .
docker buildx rm multi_arch_builder
# Replicate hooks
for dir in */ ; do if [[ -d "$dir" && "$dir" != 'hooks/' ]]; then cp -fr hooks "$dir"; fi ; done
docker run --rm -it -v $env:userprofile/Dropbox/Projects/terraform:/terraform -v $env:userprofile/.aws:/root/.aws -w /terraform hashicorp/terraform plan