From c23bd6a041ff7038f8f956c686c4279f25ede2a0 Mon Sep 17 00:00:00 2001 From: Arnaud Morin Date: Sat, 8 Jan 2022 23:36:33 +0100 Subject: [PATCH] up Signed-off-by: Arnaud Morin --- ansible/training/userdata/ansible101.sh | 1 + docker/training/lessons/1-docker101.md | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/ansible/training/userdata/ansible101.sh b/ansible/training/userdata/ansible101.sh index 666f302..7be1b97 100644 --- a/ansible/training/userdata/ansible101.sh +++ b/ansible/training/userdata/ansible101.sh @@ -50,6 +50,7 @@ wget https://www.arnaudmorin.fr/tmux.conf -O /root/.tmux.conf wget https://www.arnaudmorin.fr/plikrc -O /root/.plikrc wget https://www.arnaudmorin.fr/plik -O /usr/local/bin/plik chmod +x /usr/local/bin/plik +echo 'if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then tmux new-session -A -s ssh_tmux ;fi' >> /root/.bashrc title.print "Install docker" diff --git a/docker/training/lessons/1-docker101.md b/docker/training/lessons/1-docker101.md index 7cb5f59..12059fb 100644 --- a/docker/training/lessons/1-docker101.md +++ b/docker/training/lessons/1-docker101.md @@ -20,6 +20,8 @@ List the images ``` docker images +``` +``` ... debian latest 6f4986d78878 2 weeks ago 124MB ... @@ -48,6 +50,8 @@ Ok, now it's time to see the `docker ps` command. The `docker ps` command shows you all containers that are currently running: ``` docker ps +``` +``` CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f9c03ce13b09 demo "/usr/sbin/sshd -D" 32 minutes ago Up 32 minutes 127.0.0.2:8080->8080/tcp, 127.0.0.2:2222->22/tcp demo ``` @@ -61,15 +65,21 @@ You're probably wondering if there is a way to run more than just one command in ``` docker run -it debian bash +``` +``` / # ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var ``` Running the `run` command with the `-it` flags attaches us to an interactive tty in the container. Now we can run as many commands in the container as we want. Take some time to run your favorite commands. +To exit from the container, just type `exit` + It's now time to clean some of the old stopped containers to avoid filling your system with dead containers: ``` docker ps -a +``` +``` # grab the ID of the containers you want to clean docker rm xxyy ```