From: Ruben ten Hove Date: Wed, 13 Jul 2022 15:52:42 +0000 (-0400) Subject: fix: image manifest name; move to separate option X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=b384474be865f00a1195397bcbea98487163818f;p=stevenblack-hosts.git fix: image manifest name; move to separate option --- diff --git a/readme_template.md b/readme_template.md index a19c1cbd8..f0622a3ea 100644 --- a/readme_template.md +++ b/readme_template.md @@ -68,50 +68,52 @@ folder tree, where you will find the data for `fakenews`, `social`, `gambling`, ## Generate your own unified hosts file -You have two options to generate your own hosts file. You can do it in your own environment, or within a Docker container. We'll cover Docker first because it's a short section. +You have three options to generate your own hosts file. You can use our container image, build your own image, or do it in your own environment. Option #1 is easiest if you have Linux with Docker installed. -### Option 1: Generate in a Docker container +### Option 1: Use our container image (Linux only) -We provide a [Dockerfile](https://github.com/StevenBlack/hosts/blob/master/Dockerfile) that you can use to create a container image with everything you need. -The container will contain Python 3 and all its dependency requirements, and a copy of the latest version of this repository. +> This will replace your `/etc/hosts`. -Build the Docker container like this: +We assume you have Docker available on your host. Just run the following command. Set extensions to your preference. ```sh -docker build --no-cache . -t stevenblack-hosts +docker run --pull always --rm -it -v /etc/hosts:/etc/hosts \ +ghcr.io/stevenblack/hosts:latest updateHostsFile.py --auto \ +--replace --extensions gambling porn ``` -Then run your command as such: +If you want to add custom hosts or a whitelist, create either or both files as per +[the instructions](#how-do-i-control-which-sources-are-unified) and add the following +arguments _before_ `ghcr.io/stevenblack/hosts:latest` depending on which you wish to use. ```sh -docker run --rm -it stevenblack-hosts updateHostsFile.py +-v "path/to/myhosts:/hosts/myhosts" \ +-v "path/to/whitelist:/hosts/whitelist" \ ``` -> This will create the hosts file, and remove it with the container when done, so not very -> useful. Use the following example to automatically update your hosts file in place. +You can rerun this exact command later to update based on the latest available hosts (for example, add it to a weekly cron job). -#### Linux example +### Option 2: Generate your own container image -This will replace your `/etc/hosts`. +We provide the [Dockerfile](https://github.com/StevenBlack/hosts/blob/master/Dockerfile) used by the previous step, which you can use to create a container image with everything you need. +The container will contain Python 3 and all its dependency requirements, and a copy of the latest version of this repository. -Just run the following command. Set extensions to your preference. +Build the Docker container from the root of this repo like this: ```sh -docker run --pull always --rm -it -v /etc/hosts:/etc/hosts \ -ghcr.io/StevenBlack/hosts updateHostsFile.py --auto \ ---replace --extensions gambling porn +docker build --no-cache . -t stevenblack-hosts ``` -If you want to add custom hosts or a whitelist, create either ot both files as per -[the instructions](#how-do-i-control-which-sources-are-unified) and add the following -arguments _before_ `ghcr.io/StevenBlack/hosts` depending on which you wish to use. +Then run your command as such: ```sh --v "path/to/myhosts:/hosts/myhosts" \ --v "path/to/whitelist:/hosts/whitelist" +docker run --rm -it stevenblack-hosts updateHostsFile.py ``` -### Option 2: Generate it in your own environment +> This will create the hosts file, and remove it with the container when done, so not very +> useful. You can use the example in option #1 to add volumes so files on your host are replaced. + +### Option 3: Generate it in your own environment To generate your own amalgamated hosts files you will need Python 3.6 or later.