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/ansible/_index.md | 5 ---- content/blog/ansible/ansible-vault-example.md | 30 ++++++++++++++-------- content/blog/ansible/custom-fact.md | 14 +++++----- content/blog/ansible/dump-all-vars.md | 14 +++++++--- content/blog/cfengine/_index.md | 5 ---- content/blog/cfengine/leveraging-yaml.md | 8 +++--- content/blog/commands/_index.md | 5 ---- content/blog/commands/asterisk-call-you.md | 8 +++--- .../blog/commands/asterisk-list-active-calls.md | 8 +++--- content/blog/commands/busybox-web-server.md | 11 +++++--- content/blog/commands/capture-desktop-video.md | 10 +++++--- content/blog/commands/clean-conntrack-states.md | 10 +++++--- content/blog/commands/date.md | 10 +++++--- content/blog/commands/dmidecode.md | 10 +++++--- content/blog/commands/find-hardlinks.md | 8 +++--- content/blog/commands/find-inodes-used.md | 8 +++--- content/blog/commands/git-import-commits.md | 11 ++++---- .../blog/commands/git-rewrite-commit-history.md | 9 ++++--- content/blog/commands/ipmi.md | 8 +++--- content/blog/commands/mdadm.md | 8 +++--- content/blog/commands/megacli.md | 8 +++--- content/blog/commands/omreport.md | 7 +++-- content/blog/commands/qemu-nbd.md | 10 +++++--- content/blog/commands/qemu.md | 7 ++--- content/blog/commands/rrdtool.md | 6 ++--- content/blog/debian/_index.md | 5 ---- .../debian/error-during-signature-verification.md | 9 ++++--- content/blog/debian/force-package-removal.md | 9 ++++--- content/blog/debian/no-public-key-error.md | 9 ++++--- 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 ++++++++--- content/blog/freebsd/_index.md | 5 ---- content/blog/gentoo/_index.md | 5 ---- content/blog/kubernetes/_index.md | 5 ---- content/blog/miscellaneous/_index.md | 5 ---- content/blog/netapp/_index.md | 5 ---- content/blog/travels/_index.md | 5 ---- 40 files changed, 184 insertions(+), 173 deletions(-) delete mode 100644 content/blog/ansible/_index.md delete mode 100644 content/blog/cfengine/_index.md delete mode 100644 content/blog/commands/_index.md delete mode 100644 content/blog/debian/_index.md delete mode 100644 content/blog/docker/_index.md delete mode 100644 content/blog/freebsd/_index.md delete mode 100644 content/blog/gentoo/_index.md delete mode 100644 content/blog/kubernetes/_index.md delete mode 100644 content/blog/miscellaneous/_index.md delete mode 100644 content/blog/netapp/_index.md delete mode 100644 content/blog/travels/_index.md diff --git a/content/blog/ansible/_index.md b/content/blog/ansible/_index.md deleted file mode 100644 index 3730fd7..0000000 --- a/content/blog/ansible/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Ansible" -linkTitle: "Ansible" -weight: 30 ---- diff --git a/content/blog/ansible/ansible-vault-example.md b/content/blog/ansible/ansible-vault-example.md index fb6ef45..ac68feb 100644 --- a/content/blog/ansible/ansible-vault-example.md +++ b/content/blog/ansible/ansible-vault-example.md @@ -1,17 +1,31 @@ --- title: "Ansible vault example" -linkTitle: "Ansible vault example" date: 2018-02-21 -description: > - Ansible vault example +description: Getting started with ansible vault +tags: + - ansible --- +## Editing a protected file + Here is how to edit a vault protected file : {{< highlight sh >}} ansible-vault edit hostvars/blah.yml {{< / highlight >}} -Here is how to put a multiline entry like a private key in vault (for a simple value, just don't use a `|`): +## Using a vault entry in a task or a jinja template + +It is as simple as using any variable : +{{< highlight yaml >}} +- copy: + path: /etc/ssl/private.key + mode: 0400 + content: '{{ ssl_key }}' +{{< / highlight >}} + +## How to specify multiple lines entries + +This is actually a yaml question, not a vault one but since I ask myself this frequently in this context here is how to put a multiple lines entry like a private key in vault (for a simple value, just don't use a `|`): {{< highlight yaml >}} ssl_key : | @@ -21,13 +35,7 @@ ssl_key : | ----- END PRIVATE KEY ----- {{< /highlight >}} -And here is how to use it in a task : -{{< highlight yaml >}} -- copy: - path: /etc/ssl/private.key - mode: 0400 - content: '{{ ssl_key }}' -{{< / highlight >}} +## How to run playbooks when vault values are needed To run a playbook, you will need to pass the `--ask-vault` argument or to export a `ANSIBLE_VAULT_PASSWORD_FILE=/home/julien/.vault_pass.txt` variable (the file needs to contain a single line with your vault password here). diff --git a/content/blog/ansible/custom-fact.md b/content/blog/ansible/custom-fact.md index 21e3300..10ab6bc 100644 --- a/content/blog/ansible/custom-fact.md +++ b/content/blog/ansible/custom-fact.md @@ -1,17 +1,19 @@ --- title: "Ansible custom facts" -linkTitle: "Ansible custom facts" date: 2018-09-25 -description: > - How to write custom facte with ansible +description: How to write custom facts with ansible +tags: + - ansible --- +## Introduction + Custom facts are actually quite easy to implement despite the lack of documentation about it. -## How they work +## How custom facts work On any Ansible controlled host — that is, the remote machine that is being controlled and not the machine on which the playbook is run — you just need to create a directory at -`/etc/ansible/facts.d`. Inside this directory, you can place one or more `*.fact` files. These are files that return JSON data, which will then be included in the raft of facts that +`/etc/ansible/facts.d`. Inside this directory, you can place one or more `*.fact` files. These are files that must return JSON data, which will then be included in the raft of facts that Ansible gathers. The facts will be available to ansible at `hostvars.host.ansible_local.`. @@ -31,7 +33,7 @@ This will give you the fact `hostvars.host.ansible_local.mysql.password` for thi ## A more complex example A more interesting example is something I use with small webapps. In the container that hosts the frontent I use a small ansible role to generate a mysql password on its first run, and -provision a database with a user that has access to it on a mysql server. This fact ensures that on subsequent runs we will stay idempotents. Here is how it works. +provision a database with a user that has access to it on a mysql server. This fact ensures that on subsequent runs we will stay idempotent. First the fact from before, only slightly modified : {{< highlight sh >}} diff --git a/content/blog/ansible/dump-all-vars.md b/content/blog/ansible/dump-all-vars.md index d5991a3..e1dea05 100644 --- a/content/blog/ansible/dump-all-vars.md +++ b/content/blog/ansible/dump-all-vars.md @@ -1,11 +1,13 @@ --- title: "Dump all ansible variables" -linkTitle: "Dump all ansible variables" date: 2019-10-15 -description: > - How to dump all variables used by ansible +description: How to dump all variables used by ansible in a task +tags: + - ansible --- +## Task to use + Here is the task to use in order to achieve that : {{< highlight yaml >}} @@ -13,6 +15,8 @@ Here is the task to use in order to achieve that : action: template src=dumpall.j2 dest=ansible.all {{< /highlight >}} +## Associated template + And here is the template to use with it : {{< highlight jinja >}} @@ -36,3 +40,7 @@ HOST Variables ("hostvars"): -------------------------------- {{ hostvars | to_nice_json }} {{< /highlight >}} + +## Output + +If you are running a local task, the output will be in your playbook directory. Otherwise, it will be on the target machine(s) in a `.ansible/tmp/ansible.all` file under the user your are connecting the machine(s)' with. diff --git a/content/blog/cfengine/_index.md b/content/blog/cfengine/_index.md deleted file mode 100644 index 8b5885c..0000000 --- a/content/blog/cfengine/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Cfengine" -linkTitle: "Cfengine" -weight: 40 ---- diff --git a/content/blog/cfengine/leveraging-yaml.md b/content/blog/cfengine/leveraging-yaml.md index c1132b2..62b3a2d 100644 --- a/content/blog/cfengine/leveraging-yaml.md +++ b/content/blog/cfengine/leveraging-yaml.md @@ -1,11 +1,13 @@ --- title: "Leveraging yaml with cfengine" -linkTitle: "Leveraging yaml with cfengine" date: 2018-09-25 -description: > - How to leverage yaml inventory files with cfengine +description: How to leverage yaml inventory files with cfengine +tags: + - cfengine --- +## Introduction + CFEngine has core support for JSON and YAML. You can use this support to read, access, and merge JSON and YAML files and use these to keep policy files internal and simple. You access the data using the usual cfengine standard primitives. diff --git a/content/blog/commands/_index.md b/content/blog/commands/_index.md deleted file mode 100644 index c061e46..0000000 --- a/content/blog/commands/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Commands" -linkTitle: "Commands" -weight: 40 ---- diff --git a/content/blog/commands/asterisk-call-you.md b/content/blog/commands/asterisk-call-you.md index 7dd65f3..75d642b 100644 --- a/content/blog/commands/asterisk-call-you.md +++ b/content/blog/commands/asterisk-call-you.md @@ -1,11 +1,13 @@ --- title: "List active calls on asterisk" -linkTitle: "List active calls on asterisk" date: 2018-09-25 -description: > - How to show active calls on an asterisk system +description: How to show active calls on an asterisk system +tags: + - asterisk --- +## Using the cli + {{< highlight yaml >}} watch -d -n1 'asterisk -rx “core show channels”' {{< /highlight >}} diff --git a/content/blog/commands/asterisk-list-active-calls.md b/content/blog/commands/asterisk-list-active-calls.md index 73c712e..285d330 100644 --- a/content/blog/commands/asterisk-list-active-calls.md +++ b/content/blog/commands/asterisk-list-active-calls.md @@ -1,11 +1,13 @@ --- title: "How to have asterisk call you into a meeting" -linkTitle: "How to have asterisk call you into a meeting" date: 2018-09-25 -description: > - How to have asterisk call you itself into a meeting +description: How to have asterisk call you itself into a meeting +tags: + - asterisk --- +## Using the cli + At alterway we sometimes have DTMF problems that prevent my mobile from joining a conference room. Here is something I use to have asterisk call me and place me inside the room : diff --git a/content/blog/commands/busybox-web-server.md b/content/blog/commands/busybox-web-server.md index 37f9ac6..666fb8e 100644 --- a/content/blog/commands/busybox-web-server.md +++ b/content/blog/commands/busybox-web-server.md @@ -1,12 +1,15 @@ --- title: "Busybox web server" -linkTitle: "Busybox web server" date: 2019-04-16 -description: > - Busybox web server +description: How to serve static files from only busybox +tags: + - linux + - simple utilities --- -If you have been using things like `python -m SimpleHTTPServer`, here is something even more simple and lightweight to use : +## The command + +If you have been using things like `python -m SimpleHTTPServer` to serve static files in a pinch, here is something even more simple and lightweight to use : {{< highlight sh >}} busybox httpd -vfp 80 diff --git a/content/blog/commands/capture-desktop-video.md b/content/blog/commands/capture-desktop-video.md index f56572a..3bc0c38 100644 --- a/content/blog/commands/capture-desktop-video.md +++ b/content/blog/commands/capture-desktop-video.md @@ -1,12 +1,14 @@ --- title: "Capture a video of your desktop" -linkTitle: "Capture a video of your desktop" date: 2011-11-20 -description: > - Capture a video of your desktop +description: Capture a video of your desktop +tags: + - ffmpeg --- -You can capture a video of your linux desktop with ffmpeg : +## The command + +You can capture a video of your linux desktop very easily with ffmpeg : {{< highlight sh >}} ffmpeg -f x11grab -s xga -r 25 -i :0.0 -sameq /tmp/out.mpg diff --git a/content/blog/commands/clean-conntrack-states.md b/content/blog/commands/clean-conntrack-states.md index 8a78930..eee4da9 100644 --- a/content/blog/commands/clean-conntrack-states.md +++ b/content/blog/commands/clean-conntrack-states.md @@ -1,12 +1,14 @@ --- title: "Clean conntrack states" -linkTitle: "Clean conntrack states" date: 2018-03-02 -description: > - Clean conntrack states +description: How to clean conntrack states +tags: + - linux --- -Here is an example of how to clean conntrack states that match a specific query on a linux firewall : +## A not so simple command + +Firewalling on linux is messy, here is an example of how to clean conntrack states that match a specific query on a linux firewall : {{< highlight sh >}} conntrack -L conntrack -p tcp –orig-dport 65372 | \ diff --git a/content/blog/commands/date.md b/content/blog/commands/date.md index e0b2bcc..07d5b41 100644 --- a/content/blog/commands/date.md +++ b/content/blog/commands/date.md @@ -1,12 +1,14 @@ --- title: "Convert unix timestamp to readable date" -linkTitle: "Convert unix timestamp to readable date" date: 2011-01-06 -description: > - Convert unix timestamp to readable date +description: the -d flag of the date command combined with @timestamp +tags: + - simple utilities --- -As I somehow have a hard time remembering this simple date flags as I rarely need it, I decided to write it down here : +## The trick + +I somehow have a hard time remembering this simple date flags *(probably because I rarely get to practice it), I decided to write it down here : {{< highlight sh >}} $ date -d @1294319676 diff --git a/content/blog/commands/dmidecode.md b/content/blog/commands/dmidecode.md index c7bcc1f..52accc4 100644 --- a/content/blog/commands/dmidecode.md +++ b/content/blog/commands/dmidecode.md @@ -1,12 +1,14 @@ --- title: "DMIdecode" -linkTitle: "DMIdecode" date: 2011-02-16 -description: > - DMIdecode +description: Some DMIdecode common flags +tags: + - simple utilities --- -DMIdecode to obtain Hardware informations. +## Introduction + +DMIdecode is a tool to obtain Hardware informations. ## Mose useful commands diff --git a/content/blog/commands/find-hardlinks.md b/content/blog/commands/find-hardlinks.md index dd1b424..b4a4011 100644 --- a/content/blog/commands/find-hardlinks.md +++ b/content/blog/commands/find-hardlinks.md @@ -1,12 +1,12 @@ --- title: "Find hardlinks to a same file" -linkTitle: "Find hardlinks to a same file" date: 2018-03-02 -description: > - Find hardlinks to a same file +description: How to list hardlinks that link to the same file +tags: + - find + - simple utilities --- {{< highlight sh >}} find . -samefile /path/to/file {{< /highlight >}} - diff --git a/content/blog/commands/find-inodes-used.md b/content/blog/commands/find-inodes-used.md index d9965a4..efa29af 100644 --- a/content/blog/commands/find-inodes-used.md +++ b/content/blog/commands/find-inodes-used.md @@ -1,12 +1,12 @@ --- title: "Find where inodes are used" -linkTitle: "Find where inodes are used" date: 2018-04-25 -description: > - Find where inodes are used +description: How to locate what is taking all the inodes in the subdirectory of a given device +tags: + - find + - simple utilities --- {{< highlight sh >}} find . -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n {{< /highlight >}} - diff --git a/content/blog/commands/git-import-commits.md b/content/blog/commands/git-import-commits.md index 5ec2bc1..0286282 100644 --- a/content/blog/commands/git-import-commits.md +++ b/content/blog/commands/git-import-commits.md @@ -1,13 +1,14 @@ --- title: "Import commits from one git repo to another" -linkTitle: "Import commits from one git repo to another" date: 2018-09-25 -description: > - Import commits from one git repo to another +description: How to take commits from one git repo and bring them into another +tags: + - git --- -This imports commits from a repo in the `../masterfiles` folder and applies them to the repository inside the current folder : +## The trick + +In an ideal world there should never be a need to do this, but here is how to do it properly if you ever walk into this bizarre problem. This command imports commits from a repo in the `../masterfiles` folder and applies them to the repository inside the current folder : {{< highlight sh >}} (cd ../masterfiles/; git format-patch –stdout origin/master) | git am {{< /highlight >}} - diff --git a/content/blog/commands/git-rewrite-commit-history.md b/content/blog/commands/git-rewrite-commit-history.md index 6d241ed..8378a9c 100644 --- a/content/blog/commands/git-rewrite-commit-history.md +++ b/content/blog/commands/git-rewrite-commit-history.md @@ -1,13 +1,14 @@ --- title: "Rewrite a git commit history" -linkTitle: "Rewrite a git commit history" date: 2018-03-05 -description: > - Rewrite a git commit history +description: How to rewrite a git commit history +tags: + - git --- +## git filter-branch + Here is how to rewrite a git commit history, for example to remove a file : {{< highlight sh >}} git filter-branch –index-filter "git rm --cached --ignore-unmatch ${file}" --prune-empty --tag-name-filter cat - -all {{< /highlight >}} - diff --git a/content/blog/commands/ipmi.md b/content/blog/commands/ipmi.md index 93ca26d..2db75ee 100644 --- a/content/blog/commands/ipmi.md +++ b/content/blog/commands/ipmi.md @@ -1,11 +1,12 @@ --- title: "ipmitool" -linkTitle: "ipmitool" date: 2018-03-05 -description: > - ipmitool +description: some ipmitool command examples +tags: + - simple utilities --- +## Usage examples - launch ipmi shell : `ipmitool -H XX.XX.XX.XX -C3 -I lanplus -U shell` - launch ipmi remote text console : `ipmitool -H XX.XX.XX.XX -C3 -I lanplus -U sol activate` - Show local ipmi lan configuration : `ipmitool lan print` @@ -16,4 +17,3 @@ ipmitool lan set 1 ipaddr 10.31.149.39 ipmitool lan set 1 netmask 255.255.255.0 mc reset cold {{< /highlight >}} - diff --git a/content/blog/commands/mdadm.md b/content/blog/commands/mdadm.md index 1dbc3f8..1645c6c 100644 --- a/content/blog/commands/mdadm.md +++ b/content/blog/commands/mdadm.md @@ -1,9 +1,10 @@ --- title: "mdadm" -linkTitle: "mdadm" date: 2011-11-15 -description: > - mdadm +description: some mdadm command examples +tags: + - linux + - simple utilities --- ## Watch the array status @@ -39,4 +40,3 @@ mdadm --stop /dev/md0 mdadm --zero-superblock /dev/sda mdadm --zero-superblock /dev/sdb {{< /highlight >}} - diff --git a/content/blog/commands/megacli.md b/content/blog/commands/megacli.md index 8eb32a8..10e2a85 100644 --- a/content/blog/commands/megacli.md +++ b/content/blog/commands/megacli.md @@ -1,11 +1,11 @@ --- title: "MegaCLI" -linkTitle: "MegaCLI" date: 2018-03-05 -description: > - MegaCLI for dell hardware investigations +description: MegaCLI for dell hardware investigations +tags: + - linux --- +## Some command examples - `megacli -LDInfo -LALL -aALL|grep state` - `MegaCli -PDlist -a0|less` - diff --git a/content/blog/commands/omreport.md b/content/blog/commands/omreport.md index b3d0ffd..a5d90e5 100644 --- a/content/blog/commands/omreport.md +++ b/content/blog/commands/omreport.md @@ -1,9 +1,9 @@ --- title: "omreport" -linkTitle: "omreport" date: 2018-03-05 -description: > - omreport +description: Some omreport command examples +tags: + - linux --- ## Your raid status at a glance @@ -17,4 +17,3 @@ omreport storage vdisk omreport storage pdisk controller=0 vdisk=0 omreport storage pdisk controller=0 pdisk=0:0:4 {{< /highlight >}} - diff --git a/content/blog/commands/qemu-nbd.md b/content/blog/commands/qemu-nbd.md index ea09658..0402876 100644 --- a/content/blog/commands/qemu-nbd.md +++ b/content/blog/commands/qemu-nbd.md @@ -1,11 +1,14 @@ --- title: "qemu-nbd" -linkTitle: "qemu-nbd" date: 2019-07-01 -description: > - qemu-nbd +description: qemu-nbd usage example +tags: + - linux + - virtualization --- +## Usage example + {{< highlight sh >}} modprobe nbd max_part=8 qemu-nbd -c /dev/nbd0 image.img @@ -14,4 +17,3 @@ mount /dev/nbd0p1 /mnt # or vgscan && vgchange -ay umount /mnt qemu-nbd -d /dev/nbd0 {{< /highlight >}} - diff --git a/content/blog/commands/qemu.md b/content/blog/commands/qemu.md index b3beb2c..2a982e0 100644 --- a/content/blog/commands/qemu.md +++ b/content/blog/commands/qemu.md @@ -1,9 +1,10 @@ --- title: "Qemu" -linkTitle: "Qemu" date: 2019-06-10 -description: > - Qemu +description: Some simple qemu command usage +tags: + - linux + - virtualization --- ## Quickly launch a qemu vm with local qcow as hard drive diff --git a/content/blog/commands/rrdtool.md b/content/blog/commands/rrdtool.md index 33f54dc..05cc0b1 100644 --- a/content/blog/commands/rrdtool.md +++ b/content/blog/commands/rrdtool.md @@ -1,9 +1,9 @@ --- title: "rrdtool" -linkTitle: "rrdtool" date: 2018-09-25 -description: > - rrdtool +description: How to graph manually with rrdtool +tags: + - simple utilities --- ## Graph manually diff --git a/content/blog/debian/_index.md b/content/blog/debian/_index.md deleted file mode 100644 index 4a0403f..0000000 --- a/content/blog/debian/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Debian" -linkTitle: "Debian" -weight: 40 ---- diff --git a/content/blog/debian/error-during-signature-verification.md b/content/blog/debian/error-during-signature-verification.md index 87d7e3a..67ef11e 100644 --- a/content/blog/debian/error-during-signature-verification.md +++ b/content/blog/debian/error-during-signature-verification.md @@ -1,11 +1,14 @@ --- title: "Error occured during the signature verification" -linkTitle: "Error occured during the signature verification" date: 2015-02-27 -description: > - Error occured during the signature verification +description: Fixing the "Error occured during the signature verification" +tags: + - debian + - linux --- +## How to fix + Here is how to fix the apt-get “Error occured during the signature verification” : {{< highlight sh >}} cd /var/lib/apt diff --git a/content/blog/debian/force-package-removal.md b/content/blog/debian/force-package-removal.md index c1a4862..fedeee2 100644 --- a/content/blog/debian/force-package-removal.md +++ b/content/blog/debian/force-package-removal.md @@ -1,11 +1,14 @@ --- title: "Force package removal" -linkTitle: "Force package removal" date: 2015-01-27 -description: > - Force package removal +description: How to force the removal of a package +tags: + - debian + - linux --- +## How to force the removal of a package + Here is how to force package removal when post-uninstall script fails : {{< highlight sh >}} dpkg --purge --force-all diff --git a/content/blog/debian/no-public-key-error.md b/content/blog/debian/no-public-key-error.md index 15e9a01..a16938e 100644 --- a/content/blog/debian/no-public-key-error.md +++ b/content/blog/debian/no-public-key-error.md @@ -1,11 +1,14 @@ --- title: "Fix the no public key available error" -linkTitle: "Fix the no public key available error" date: 2016-01-27 -description: > - Fix the no public key available error +description: How to fix this common debian error when using non official repositories +tags: + - debian + - linux --- +## How to fix + Here is how to fix the no public key available error : {{< highlight sh >}} apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYID 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"] diff --git a/content/blog/freebsd/_index.md b/content/blog/freebsd/_index.md deleted file mode 100644 index b93f302..0000000 --- a/content/blog/freebsd/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "FreeBSD" -linkTitle: "FreeBSD" -weight: 40 ---- diff --git a/content/blog/gentoo/_index.md b/content/blog/gentoo/_index.md deleted file mode 100644 index 1eee11b..0000000 --- a/content/blog/gentoo/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Gentoo" -linkTitle: "Gentoo" -weight: 40 ---- diff --git a/content/blog/kubernetes/_index.md b/content/blog/kubernetes/_index.md deleted file mode 100644 index 3545b68..0000000 --- a/content/blog/kubernetes/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Kubernetes" -linkTitle: "Kubernetes" -weight: 40 ---- diff --git a/content/blog/miscellaneous/_index.md b/content/blog/miscellaneous/_index.md deleted file mode 100644 index 806622d..0000000 --- a/content/blog/miscellaneous/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Miscellaneous" -linkTitle: "Miscellaneous" -weight: 40 ---- diff --git a/content/blog/netapp/_index.md b/content/blog/netapp/_index.md deleted file mode 100644 index 55bab1b..0000000 --- a/content/blog/netapp/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Netapp" -linkTitle: "Netapp" -weight: 30 ---- diff --git a/content/blog/travels/_index.md b/content/blog/travels/_index.md deleted file mode 100644 index 4ffe08a..0000000 --- a/content/blog/travels/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "Travels" -linkTitle: "Travels" -weight: 20 ---- -- cgit v1.2.3