diff options
author | Julien Dessaux | 2020-04-28 17:29:52 +0200 |
---|---|---|
committer | Julien Dessaux | 2020-04-28 17:29:52 +0200 |
commit | 6cc9d8c72a56563b6d1a12b8b441dfa9dde345e9 (patch) | |
tree | 042852f7a8a18f65c8d5191234c8ed1cb85fd8a4 /content/en/blog/docker | |
parent | Initial import (diff) | |
download | www-6cc9d8c72a56563b6d1a12b8b441dfa9dde345e9.tar.gz www-6cc9d8c72a56563b6d1a12b8b441dfa9dde345e9.tar.bz2 www-6cc9d8c72a56563b6d1a12b8b441dfa9dde345e9.zip |
Long overdue first commit with content
Diffstat (limited to '')
-rw-r--r-- | content/en/blog/docker/_index.md | 5 | ||||
-rwxr-xr-x | content/en/blog/docker/cleaning.md | 12 | ||||
-rwxr-xr-x | content/en/blog/docker/docker-compose-bridge.md | 31 | ||||
-rwxr-xr-x | content/en/blog/docker/migrate-data-volume.md | 15 | ||||
-rwxr-xr-x | content/en/blog/docker/shell-usage-in-dockerfile.md | 16 |
5 files changed, 79 insertions, 0 deletions
diff --git a/content/en/blog/docker/_index.md b/content/en/blog/docker/_index.md new file mode 100644 index 0000000..18c3c33 --- /dev/null +++ b/content/en/blog/docker/_index.md @@ -0,0 +1,5 @@ +--- +title: "Docker" +linkTitle: "Docker" +weight: 40 +--- diff --git a/content/en/blog/docker/cleaning.md b/content/en/blog/docker/cleaning.md new file mode 100755 index 0000000..f36bbd7 --- /dev/null +++ b/content/en/blog/docker/cleaning.md @@ -0,0 +1,12 @@ +--- +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 +--- + +Be carefull that this will delete any stopped container and remove any locally unused image and tags : +{{< highlight sh >}} +docker system prune -f -a +{{< /highlight >}} diff --git a/content/en/blog/docker/docker-compose-bridge.md b/content/en/blog/docker/docker-compose-bridge.md new file mode 100755 index 0000000..16a823d --- /dev/null +++ b/content/en/blog/docker/docker-compose-bridge.md @@ -0,0 +1,31 @@ +--- +title: "Docker compose predictable bridge" +linkTitle: "Docker compose predictable bridge" +date: 2018-09-25 +description: > + How to use a predefined bridge with docker compose +--- + +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 : + +{{< highlight yaml >}} +version: '3.0' + +services: + sshportal: + image: moul/sshportal + environment: + - SSHPORTAL_DEFAULT_ADMIN_INVITE_TOKEN=integration + command: server --debug + depends_on: + - testserver + ports: + - 2222 + network_mode: "bridge" +networks: + default: + external: + name: bridge +{{< /highlight >}} diff --git a/content/en/blog/docker/migrate-data-volume.md b/content/en/blog/docker/migrate-data-volume.md new file mode 100755 index 0000000..4f54394 --- /dev/null +++ b/content/en/blog/docker/migrate-data-volume.md @@ -0,0 +1,15 @@ +--- +title: "Migrate a data volume" +linkTitle: "Migrate a data volume" +date: 2018-01-30 +description: > + How to migrate a data volume +--- + +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 : +{{< highlight sh >}} +export VOLUME=tiddlywiki +export DEST=10.1.0.242 +docker run --rm -v $VOLUME:/from alpine ash -c "cd /from ; tar -cpf - . " \ +| ssh $DEST "docker run --rm -i -v $VOLUME:/to alpine ash -c 'cd /to ; tar -xfp - ' " +{{< /highlight >}} diff --git a/content/en/blog/docker/shell-usage-in-dockerfile.md b/content/en/blog/docker/shell-usage-in-dockerfile.md new file mode 100755 index 0000000..868fe21 --- /dev/null +++ b/content/en/blog/docker/shell-usage-in-dockerfile.md @@ -0,0 +1,16 @@ +--- +title: "Shell usage in dockerfile" +linkTitle: "Shell usage in dockerfile" +date: 2019-02-04 +description: > + How to use a proper shell in a dockerfile +--- + +The default shell is `[“/bin/sh”, “-c”]`, which doesn't handle pipe fails when chaining commands. To process errors when using pipes use this : + +{{< highlight sh >}} +SHELL ["/bin/bash", "-eux", "-o", "pipefail", "-c"] +{{< /highlight >}} + +## References +- https://bearstech.com/societe/blog/securiser-et-optimiser-notre-liste-des-bonnes-pratiques-liees-aux-dockerfiles/ |