Merge pull request #147 in DNS/adguard-dns from docker-versions to master

* commit '27ea739cfdc782daeca07ae8af6bb8f6ef6d65b3':
  fix
  doc
  Fix to go along with new concept
  Build latest from tag branch, edge from master
This commit is contained in:
Eugene Bujak 2019-02-11 19:44:24 +03:00
commit 0d5f24927c
4 changed files with 119 additions and 15 deletions

94
Docker.md Normal file
View File

@ -0,0 +1,94 @@
# AdGuard Home - Docker
AdGuard Home is a network-wide software for blocking ads & tracking. After you set it up, it'll cover ALL your home devices, and you don't need any client-side software for that.
## How does AdGuard Home work?
AdGuard Home operates as a DNS server that re-routes tracking domains to a "black hole," thus preventing your devices from connecting to those servers. It's based on software we use for our public [AdGuard DNS](https://adguard.com/en/adguard-dns/overview.html) servers -- both share a lot of common code.
## Supported tags / architectures
`adguard/adguardhome` image is built for different architectures and supports the following tags:
* `latest` - latest **stable** build from the last tagged release.
* `edge` - latest build from the repository **master** trunk, may be unstable.
* `$version` - specific release e.g. `v0.92`.
### Tags for different architectures
* **ARM64** - 64bit ARM build
* `arm64-latest`
* `arm64-edge`
* **ARMHF** - 32bit ARM build
* `armhf-latest`
* `armhf-edge`
* **i386** - x86 build
* `i386-latest`
* `i386-edge`
* **AMD64** - x86_64 build **default**
* `latest`
* `edge`
## Usage
To run `AdGuardHome` image:
```bash
docker run -d -p 53:53 -p 53:53/udp -p 3000:3000 adguard/adguardhome
```
Now open the browser and navigate to http://DOCKER_HOST_IP:3000/ to control your AdGuard Home service.
## Persistent configuration / data
There are several ways to store data used by applications that run in Docker containers.
We encourage users of the `adguard/adguardhome` images to familiarize themselves with the options available, including:
* Let Docker manage the storage of data by writing the files to disk on the host system using its own internal volume management.
This is the default and is easy and fairly transparent to the user.
The downside is that the files may be hard to locate for tools and applications that run directly on the host system, i.e. outside containers.
* Create a data directory on the host system (outside the container) and mount this to a directory visible from inside the container.
This places the files in a known location on the host system, and makes it easy for tools and applications on
the host system to access the files. The downside is that the user needs to make sure that the directory exists, and
that e.g. directory permissions and other security mechanisms on the host system are set up correctly.
The image exposes two volumes for data/configuration persistence:
* Configuration - `/opt/adguardhome/conf`
* Filters and data - `/opt/adguardhome/work`
The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blogs and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above:
Create a **data** directory on a suitable volume on your host system, e.g. **/my/own/workdir**.
Create a **config** directory on a suitable volume on your host system, e.g. **/my/own/confdir**.
Start your `adguard/adguardhome` container like this:
```
docker run --name adguardhome -v /my/own/workdir:/opt/adguardhome/work -v /my/own/confdir:/opt/adguardhome/conf -d -p 53:53 -p 53:53/udp -p 3000:3000 adguard/adguardhome
```
The `-v /my/own/workdir:/opt/adguardhome/work` part of the command mounts the `/my/own/workdir` directory from the underlying host system as `/opt/adguardhome/work` inside the container,
where AdGuardHome by default will write its data files.
### Additional configuration
Upon the first execution, a file named `AdGuardHome.yaml` will be created, with default values written in it.
You can modify the file while your AdGuard Home container is not running.
Otherwise, any changes to the file will be lost because the running program will overwrite them.
Settings are stored in [YAML format](https://en.wikipedia.org/wiki/YAML), possible parameters that you can configure are listed on [Project homepage](https://github.com/AdguardTeam/AdGuardHome).
## How to update
```bash
docker pull adguard/adguardhome
```
To update the image for a specific architecture e.g. `arm64`:
```bash
docker pull adguard/adguardhome:arm64-latest
```

View File

@ -12,13 +12,13 @@ LABEL maintainer="AdGuard Team <devteam@adguard.com>"
# Update CA certs # Update CA certs
RUN apk --no-cache --update add ca-certificates && \ RUN apk --no-cache --update add ca-certificates && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/* && mkdir -p /opt/adguardhome
COPY --from=build /src/AdGuardHome/AdGuardHome /AdGuardHome COPY --from=build /src/AdGuardHome/AdGuardHome /opt/adguardhome/AdGuardHome
EXPOSE 53 3000 EXPOSE 53 3000
VOLUME /data VOLUME ["/opt/adguardhome/conf", "/opt/adguardhome/work"]
ENTRYPOINT ["/AdGuardHome"] ENTRYPOINT ["/opt/adguardhome/AdGuardHome"]
CMD ["-h", "0.0.0.0"] CMD ["-h", "0.0.0.0", "-c", "/opt/adguardhome/conf/AdGuardHome.yaml", "-w", "/opt/adguardhome/work"]

View File

@ -3,13 +3,14 @@ LABEL maintainer="AdGuard Team <devteam@adguard.com>"
# Update CA certs # Update CA certs
RUN apk --no-cache --update add ca-certificates && \ RUN apk --no-cache --update add ca-certificates && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/* && mkdir -p /opt/adguardhome
COPY ./AdGuardHome /AdGuardHome
COPY ./AdGuardHome /opt/adguardhome/AdGuardHome
EXPOSE 53 3000 EXPOSE 53 3000
VOLUME /data VOLUME ["/opt/adguardhome/conf", "/opt/adguardhome/work"]
ENTRYPOINT ["/AdGuardHome"] ENTRYPOINT ["/opt/adguardhome/AdGuardHome"]
CMD ["-h", "0.0.0.0"] CMD ["-h", "0.0.0.0", "-c", "/opt/adguardhome/conf/AdGuardHome.yaml", "-w", "/opt/adguardhome/work"]

View File

@ -5,9 +5,11 @@ set -o pipefail
set -x set -x
DOCKERFILE="Dockerfile.travis" DOCKERFILE="Dockerfile.travis"
if [ "${TRAVIS_BRANCH}" == "master" ] IMAGE_NAME="adguard/adguardhome"
if [[ "${TRAVIS_BRANCH}" == "master" ]]
then then
VERSION="latest" VERSION="edge"
else else
VERSION=`git describe --abbrev=4 --dirty --always --tags` VERSION=`git describe --abbrev=4 --dirty --always --tags`
fi fi
@ -37,11 +39,11 @@ build_image() {
;; ;;
esac esac
if [ "${GOOS}" == "linux" ] && [ "${GOARCH}" == "amd64" ] if [[ "${GOOS}" == "linux" ]] && [[ "${GOARCH}" == "amd64" ]]
then then
image="adguard/adguardhome:${VERSION}" image="${IMAGE_NAME}:${VERSION}"
else else
image="adguard/adguardhome:${imageArch}-${VERSION}" image="${IMAGE_NAME}:${imageArch}-${VERSION}"
fi fi
make cleanfast; CGO_DISABLED=1 make make cleanfast; CGO_DISABLED=1 make
@ -50,6 +52,13 @@ build_image() {
docker tag "multiarch/alpine:${alpineArch}" "$from" docker tag "multiarch/alpine:${alpineArch}" "$from"
docker build -t "${image}" -f ${DOCKERFILE} . docker build -t "${image}" -f ${DOCKERFILE} .
docker push ${image} docker push ${image}
if [[ "${VERSION}" != "edge" ]]
then
latest=${image/$VERSION/latest}
docker tag "${image}" "${latest}"
docker push ${latest}
docker rmi ${latest}
fi
docker rmi "$from" docker rmi "$from"
} }