Created
January 15, 2020 13:34
-
-
Save stefanofiorentino/a2971f01cb9a19a6cdf5a7f90bbb3fc7 to your computer and use it in GitHub Desktop.
Laboratorio IoT @ Relewant SA - 15 gennaio 2020
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
# 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