From a74f5c4939c675a666210a8922d25a6944161167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C5=A9=20Ng=E1=BB=8Dc=20C=C6=B0=E1=BB=9Dng?= Date: Wed, 25 Sep 2019 00:40:08 +0000 Subject: [PATCH] add docker-compose's cheatsheet --- cheats/docker-compose.cheat | 20 ++++++++++++++++++++ cheats/docker.cheat | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 cheats/docker-compose.cheat diff --git a/cheats/docker-compose.cheat b/cheats/docker-compose.cheat new file mode 100644 index 0000000..4aee3f3 --- /dev/null +++ b/cheats/docker-compose.cheat @@ -0,0 +1,20 @@ +# Builds, (re)creates, starts, and attaches to containers for all services +docker-compose up + +# Builds, (re)creates, starts, and dettaches to containers for all services +docker-compose up -d + +# Builds, (re)creates, starts, and attaches to containers for a service +docker-compose up -d + +# Builds, (re)creates, starts, and dettaches to containers for a service +docker-compose up -d + +# Print the last lines of a service’s logs +docker-compose logs --tail 100 | less + +# Print the last lines of a service's logs and following its logs +docker-compose logs -f --tail 100 + +# Stops containers and removes containers, networks created by up +docker-compose down \ No newline at end of file diff --git a/cheats/docker.cheat b/cheats/docker.cheat index 098b3a5..66f76b4 100644 --- a/cheats/docker.cheat +++ b/cheats/docker.cheat @@ -36,5 +36,11 @@ docker exec -it bash # Print the last lines of a container’s logs docker logs --tail 100 | less +# Print the last lines of a container's logs and following its logs +docker logs --tail 100 -f + +# Create new network +docker network create + $ image_id: docker images --- --headers 1 --column 3 $ container_id: docker ps --- --headers 1 --column 1 \ No newline at end of file