Git Product home page Git Product logo

docker-tor-simple's Introduction

docker-tor-simple

License: MIT

Smallest minimal docker container for Tor network proxy daemon.

Suitable for relay, exit node or hidden service modes with SOCKS5 proxy enabled. It works well as a single self-contained container or in cooperation with other containers (like nginx and osminogin/php-fpm) for organizing complex hidden services on the Tor network.

The image is based on great Alpine Linux distribution so it is has extremely low size (less than 5 MB).

Star this project on Docker Hub ๐ŸŒŸ https://hub.docker.com/r/osminogin/tor-simple/

Ports

  • 9050 SOCKSv5 (without auth)

Volumes

  • /var/lib/tor data dir.

Getting started

Installation

Automated builds of the image are available on Docker Hub and is the recommended method of installation.

docker pull osminogin/tor-simple

Alternatively you can build the image yourself.

docker build -t tor github.com/osminogin/docker-tor-simple

Quickstart

docker run -p 127.0.0.1:9050:9050 --name tor osminogin/tor-simple

# or
docker-compose up

After start Tor proxy available on localhost:9050

โ—Warningโ—

Don't bind SOCKSv5 port 9050 to public network addresses if you don't know exactly what you are doing (better bind to localhost as in the example above).

Advanced usage

You can copy original tor config from container, modify and mount them back inside. Changing the configuration file is required for running Tor as exit node, relay or bridge. For some operation modes you need to expose additional ports (9001, 9030, 9051).

# Copy config
docker cp tor:/etc/tor/torrc /root/torrc

# ... modify torrc and run
docker run --rm --name tor \
  --publish 127.0.0.1:9050:9050 \
  --expose 9001 --publish 9001:9001 \ # ORPort
  --expose 9030 --publish 9030:9030 \
  --expose 9051 --publish 9051:9051 \
  --volume /root/torrc:/etc/tor/torrc:ro \
  osminogin/tor-simple

Unit file for systemd

tor.service

[Unit]
Description=Tor service
Wants=network-online.target
Requires=docker.service
After=docker.service network.target network-online.target

[Service]
TimeoutStartSec=0
Restart=always
RestartSec=15s
ExecStartPre=/usr/bin/docker pull osminogin/tor-simple
ExecStart=/usr/bin/docker run --rm --name tor -p 127.0.0.1:9050:9050 osminogin/tor-simple
ExecStop=/usr/bin/docker stop tor

[Install]
WantedBy=multi-user.target

Examples

Example webserver deployment config with microservice architecture to setup Tor hidden service.

docker-compose.yml

tor-node:
  image: osminogin/tor-simple
  links:
    - nginx:myservice

nginx:
  image: nginx
  links:
    - drupal:drupalhost
  volumes:
    - /srv/drupal:/srv/www:ro
    - /srv/nginx/nginx.conf:/etc/nginx/nginx.conf:ro

drupal:
  image: osminogin/php-fpm
  links:
    - mysql:mysqlhost
  volumes:
    - /srv/drupal:/srv/www

mysql:
  image: mariadb
  environment:
    MYSQL_ROOT_PASSWORD: changeme

License

MIT

docker-tor-simple's People

Contributors

osminogin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.