From 1a4981a826bb94c478c6f49721396ec03e02649c Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 11 Mar 2021 19:47:26 +0100 Subject: First big articles reformatting now that I properly understand hugo --- content/blog/docker/_index.md | 5 ----- content/blog/docker/cleaning.md | 11 +++++++---- content/blog/docker/docker-compose-bridge.md | 15 ++++++++++----- content/blog/docker/migrate-data-volume.md | 11 +++++++---- content/blog/docker/shell-usage-in-dockerfile.md | 15 +++++++++++---- 5 files changed, 35 insertions(+), 22 deletions(-) delete mode 100644 content/blog/docker/_index.md (limited to 'content/blog/docker') diff --git a/content/blog/docker/_index.md b/content/blog/docker/_index.md deleted file mode 100644 index 18c3c33..0000000 --- a/content/blog/docker/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Docker" -linkTitle: "Docker" -weight: 40 ---- diff --git a/content/blog/docker/cleaning.md b/content/blog/docker/cleaning.md index f36bbd7..dc33257 100644 --- a/content/blog/docker/cleaning.md +++ b/content/blog/docker/cleaning.md @@ -1,12 +1,15 @@ --- title: "Cleaning a docker host" -linkTitle: "Cleaning a docker host" date: 2018-01-29 -description: > - How to retrieve storage space by cleaning a docker host +description: How to retrieve storage space by cleaning a docker host +tags: + - docker + - linux --- -Be carefull that this will delete any stopped container and remove any locally unused image and tags : +## The command + +Be careful that this will delete any stopped container and remove any locally unused images, volumes and tags : {{< highlight sh >}} docker system prune -f -a {{< /highlight >}} diff --git a/content/blog/docker/docker-compose-bridge.md b/content/blog/docker/docker-compose-bridge.md index 16a823d..f460c6c 100644 --- a/content/blog/docker/docker-compose-bridge.md +++ b/content/blog/docker/docker-compose-bridge.md @@ -1,14 +1,19 @@ --- title: "Docker compose predictable bridge" -linkTitle: "Docker compose predictable bridge" date: 2018-09-25 -description: > - How to use a predefined bridge with docker compose +description: How to use a predefined bridge with docker compose +tags: + - docker + - linux --- +## The problem + By default, docker-compose will create a network with a randomly named bridge. If you are like me using a strict firewall on all your machines, this just cannot work. -You need to put your services in `network_mode: “bridge”` and add a custom `network` entry like : +## The fix + +For example if your bridge is named docbr1, you need to put your services in `network_mode: “bridge”` and add a custom `network` entry like : {{< highlight yaml >}} version: '3.0' @@ -27,5 +32,5 @@ services: networks: default: external: - name: bridge + name: docbr1 {{< /highlight >}} diff --git a/content/blog/docker/migrate-data-volume.md b/content/blog/docker/migrate-data-volume.md index 4f54394..0389a47 100644 --- a/content/blog/docker/migrate-data-volume.md +++ b/content/blog/docker/migrate-data-volume.md @@ -1,12 +1,15 @@ --- title: "Migrate a data volume" -linkTitle: "Migrate a data volume" date: 2018-01-30 -description: > - How to migrate a data volume +description: How to migrate a data volume between two hosts +tags: + - docker + - linux --- -Here is how to migrate a data volume between two of your hosts. A rsync of the proper `/var/lib/docker/volumes` subfolder would work just as well, but is here a fun way to do it with docker and pipes : +## The command + +Here is how to migrate a data volume between two of your hosts. A rsync of the proper `/var/lib/docker/volumes` subfolder would work just as well, but here is a fun way to do it with docker and pipes : {{< highlight sh >}} export VOLUME=tiddlywiki export DEST=10.1.0.242 diff --git a/content/blog/docker/shell-usage-in-dockerfile.md b/content/blog/docker/shell-usage-in-dockerfile.md index 868fe21..5314b33 100644 --- a/content/blog/docker/shell-usage-in-dockerfile.md +++ b/content/blog/docker/shell-usage-in-dockerfile.md @@ -1,12 +1,19 @@ --- title: "Shell usage in dockerfile" -linkTitle: "Shell usage in dockerfile" date: 2019-02-04 -description: > - How to use a proper shell in a dockerfile +description: How to use a proper shell in a dockerfile +tags: + - docker + - linux --- -The default shell is `[“/bin/sh”, “-c”]`, which doesn't handle pipe fails when chaining commands. To process errors when using pipes use this : +## The problem + +The default shell is `[“/bin/sh”, “-c”]`, which doesn't handle pipe fails when chaining commands. + +## The fix + +To process errors when using pipes use this : {{< highlight sh >}} SHELL ["/bin/bash", "-eux", "-o", "pipefail", "-c"] -- cgit v1.2.3