Sign inSign up

betaathe/tor

By betaathe

•Updated about 4 years ago

Alpine based Docker container of a TOR Relay with Nyx monitoring

Image
0

787

betaathe/tor repository overview

This is an Alpine based Docker container TOR Relay with nyx monitoring integrated. Non-official.

⁠Information
⁠Volumes used:
  • /etc/tor (for TOR config)
  • /var/lib/tor (for TOR data)
  • /etc/localtime (for time sync)
⁠Ports used:
  • 9001 (for TOR data)
  • 9030 (for TOR directory)
⁠Run nyx:

Use docker exec to run nyx from inside the tor container: docker exec -it tor nyx

You can also alias it: alias nyx='docker exec -it tor nyx'

⁠Examples:
⁠Docker run

docker run -d --name tor --restart=always -p 9001:9001 -p 9030:9030 -v tor_data:/var/lib/tor -v tor_config:/etc/tor -v /etc/localtime:/etc/localtime:ro betaathe/tor

⁠dockercompose.yml

services:
  tor: 
    image: betaathe/tor
    container_name: tor
    volumes:
      - tor_data:/var/lib/tor
      - tor_config:/etc/tor
      - /etc/localtime:/etc/localtime:ro
    restart: always
    ports:
     - 9001:9001
     - 9030:9030

volumes:
    tor_data:
    tor_config:
⁠torrc

Before starting the container for the first time, you need to add this torrc file to the tor_config volume. Customize it as you wish and start the container.

## The IP address or hostname for incoming connections (leave commented and Tor will guess)
#Address example.com

## Set the nickname of this relay
Nickname TORRELAY

## Set your own contact info
ContactInfo [email protected]

## If you control multiple relays, include then in the family
#MyFamily $keyid,$keyid,...


ORPort 9001
DirPort 9030
ControlPort 9051
CookieAuthentication 1

RelayBandwidthRate 10 MB
RelayBandwidthBurst 12 MB
#AccountingMax 32 GB
#AccountingStart day 00:00

SocksPort 0
SocksPolicy reject *

ExitPolicy reject *:*

Log notice file /var/log/tor-notices.log
DataDirectory /var/lib/tor
⁠Dockerfile used:
RUN apk add --no-cache tor python3 \
    && python3 -m ensurepip \
    && rm -r /usr/lib/python*/ensurepip \
    && if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi \
    && pip install --upgrade pip setuptools \
    && pip install nyx \
    && pip uninstall pip -y \
    && rm -r /root/.cache

VOLUME /etc/tor /var/lib/tor /etc/localtime
EXPOSE 9001 9030
CMD ["tor", "-f", "/etc/tor/torrc"]

Disclaimer: I'll try to maintain this image updated with the latest tor package, but I don't guarantee that.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Tag summary

Content type

Image

Digest

Size

22.9 MB

Last updated

about 4 years ago

docker pull betaathe/tor