Skip to content

Instantly share code, notes, and snippets.

@stefanofiorentino
Created January 15, 2020 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanofiorentino/a2971f01cb9a19a6cdf5a7f90bbb3fc7 to your computer and use it in GitHub Desktop.
Save stefanofiorentino/a2971f01cb9a19a6cdf5a7f90bbb3fc7 to your computer and use it in GitHub Desktop.
Laboratorio IoT @ Relewant SA - 15 gennaio 2020
# SHELL 1:
tmux
Ctrl+b \"
Ctrl+b o
# SHELL 1: clean docker env
docker ps -aq | xargs -r -n1 docker rm -f
docker images -aq | xargs -r -n1 docker rmi -f
clear
# esempio busybox
docker run \
-it \
--name busybox \
busybox:latest
$> cd
$> ls
$> touch demo
# SHELL 2: commit image
docker ps \
| grep "busybox:latest" \
| awk '{print $1}' \
| xargs -r -n1 -I '{}' \
docker commit {} busybox:latest
# save images
docker save busybox > busybox.tar
# SHELL 1: clean docker env
$> Ctrl+D
docker ps -aq | xargs -r -n1 docker rm -f
docker images -aq | xargs -r -n1 docker rmi -f
clear
# watchtower
docker run \
--name watchtower \
--rm \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower \
--no-pull \
-i 10 \
--cleanup
# SHELL 2: run busybox
docker run \
-it \
--name busybox \
busybox:latest
# SHELL 3: load new image
docker load -i busybox.tar
# check watchtower does its work
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment