mirror of
https://github.com/StevenBlack/hosts.git
synced 2024-06-02 12:05:33 +02:00
simpler instructions
This commit is contained in:
parent
dba24e8a3e
commit
3573a01dca
|
@ -4,8 +4,8 @@ ENV IN_CONTAINER 1
|
|||
|
||||
RUN apk add --no-cache git sudo
|
||||
|
||||
COPY . /usr/src/hosts
|
||||
COPY . /hosts
|
||||
|
||||
RUN pip install --no-cache-dir --upgrade -r /usr/src/hosts/requirements.txt
|
||||
RUN pip install --no-cache-dir --upgrade -r /hosts/requirements.txt
|
||||
|
||||
ENV PATH $PATH:/usr/src/hosts
|
||||
ENV PATH $PATH:/hosts
|
||||
|
|
|
@ -84,27 +84,33 @@ docker build --no-cache . -t stevenblack-hosts
|
|||
Then run your command as such:
|
||||
|
||||
```sh
|
||||
docker run --rm -it -v "${PWD}/test:/pwd" stevenblack-hosts updateHostsFile.py
|
||||
docker run --rm -it ghcr.io/StevenBlack/hosts updateHostsFile.py
|
||||
```
|
||||
|
||||
> It is recommended to mount a host directory, so your changes are saved when you exit
|
||||
the container. Add `-v "${PWD}:/pwd" -w /pwd` after `-it` to mount your current working
|
||||
directory, and have that as current working directory in your container.
|
||||
> This will create the 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.
|
||||
|
||||
#### Linux example
|
||||
|
||||
This will replace your `/etc/hosts` and optionally add any custom hosts.
|
||||
This will replace your `/etc/hosts`.
|
||||
|
||||
(Optionally) First create custom hosts files as per [the instructions](#how-do-i-control-which-sources-are-unified).
|
||||
|
||||
Then run the following command in that same directory. Set extensions to your preference.
|
||||
Just run the following command. Set extensions to your preference.
|
||||
|
||||
```sh
|
||||
docker run --pull always --rm -it -v /etc/hosts:/etc/hosts -v "${PWD}:/pwd" \
|
||||
-w /pwd ghcr.io/StevenBlack/hosts updateHostsFile.py --auto \
|
||||
docker run --pull always --rm -it -v /etc/hosts:/etc/hosts \
|
||||
ghcr.io/StevenBlack/hosts updateHostsFile.py --auto \
|
||||
--replace --extensions gambling porn
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
```sh
|
||||
-v "path/to/myhosts:/hosts/myhosts" \
|
||||
-v "path/to/whitelist:/hosts/whitelist"
|
||||
```
|
||||
|
||||
### Option 2: Generate it in your own environment
|
||||
|
||||
To generate your own amalgamated hosts files you will need Python 3.6 or later.
|
||||
|
|
Loading…
Reference in New Issue
Block a user