Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| projects:zibaldone:linux:docker [2022/10/25 09:54] – [docker swarm] sscipioni | projects:zibaldone:linux:docker [2023/04/19 08:08] (current) – [docker registry (public)] sscipioni | ||
|---|---|---|---|
| Line 157: | Line 157: | ||
| </ | </ | ||
| + | ===== multi platform build ===== | ||
| + | |||
| + | Multi platform build need a docker registry, local or remote (see below) | ||
| + | |||
| + | create a docker builder or use existing one | ||
| + | < | ||
| + | NAME=builder1 | ||
| + | docker buildx use $NAME || docker buildx create --use --name $NAME --driver-opt network=host | ||
| + | </ | ||
| + | |||
| + | build from a Dockerfile and push to local registry | ||
| + | < | ||
| + | REGISTRY=localhost: | ||
| + | docker buildx build --platform=linux/ | ||
| + | </ | ||
| ===== docker registry (private) ===== | ===== docker registry (private) ===== | ||
| Line 183: | Line 198: | ||
| reg digest docker.csgalileo.org/ | reg digest docker.csgalileo.org/ | ||
| </ | </ | ||
| + | |||
| + | docker registry on localhost | ||
| + | <file yaml docker-compose.yml> | ||
| + | services: | ||
| + | registry: | ||
| + | restart: no | ||
| + | image: registry:2 | ||
| + | ports: | ||
| + | - 5000:5000 | ||
| + | volumes: | ||
| + | - ./ | ||
| + | </ | ||
| ===== docker registry (public) ===== | ===== docker registry (public) ===== | ||
| Line 195: | Line 222: | ||
| docker push scipioit/ | docker push scipioit/ | ||
| </ | </ | ||
| + | |||
| + | ===== remote display via ssh ===== | ||
| + | |||
| + | scenario: connect to remote docker host via ssh and run X11 GUI on client ssh | ||
| + | |||
| + | on docker host sshd edit / | ||
| + | < | ||
| + | X11Forwarding yes | ||
| + | X11DisplayOffset 10 | ||
| + | X11UseLocalhost no | ||
| + | </ | ||
| + | |||
| + | on docker host create this helper script | ||
| + | <code bash | set-display.sh> | ||
| + | XAUTH=/ | ||
| + | HOSTIP=$(ip -o route get to 8.8.8.8 | sed -n ' | ||
| + | |||
| + | AUTH_COOKIE=$(xauth list ${DISPLAY} | awk ' | ||
| + | DISPLAY_NUMBER=$(echo $DISPLAY | cut -d. -f1 | cut -d: -f2) | ||
| + | export DISPLAY=${HOSTIP}: | ||
| + | touch $XAUTH | ||
| + | xauth -f $XAUTH add ${DISPLAY} MIT-MAGIC-COOKIE-1 ${AUTH_COOKIE} | ||
| + | </ | ||
| + | |||
| + | session from client | ||
| + | <code bash> | ||
| + | ssh -X < | ||
| + | source set-display.sh | ||
| + | docker run --rm -e DISPLAY=$DISPLAY -v $XAUTH:/ | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| ===== docker swarm ===== | ===== docker swarm ===== | ||
| Line 289: | Line 349: | ||
| </ | </ | ||
| - | get stack using a particular network ' | + | drain a node from containers and migrate to others |
| + | < | ||
| + | docker node update --availability drain < | ||
| + | |||
| + | # re-enable node after maintenance | ||
| + | docker node update --availability active < | ||
| + | </ | ||
| + | |||
| + | get services | ||
| < | < | ||
| docker network inspect --verbose web | jq ' | docker network inspect --verbose web | jq ' | ||
| + | </ | ||
| + | |||
| + | get ip allocation in docker networks | ||
| + | < | ||
| + | docker run -it --rm -v / | ||
| </ | </ | ||