version: '2.2'
services:
  relay:
    image: chriswayg/tor-server
    init: true
    restart: always
    network_mode: host
    ports:
      - "9001:9001"
      - "9030:9030"
      #- "54444:54444"
    environment:
      ## set your Nickname here (only use letters and numbers)
      # you can override these in `torrc`, if you mount it on the host
      TOR_NICKNAME: Tor4
      ## an email address to contact you
      #CONTACT_EMAIL: tor4@example.org
    volumes:
      ## mount custom `torrc` and DataDirectory here
      - ./data/:/var/lib/tor/
      - ./config/torrc:/etc/tor/torrc
      ## alternatively mount previously saved identity keys here
      #- ./tests/data/keys/secret_id_key:/var/lib/tor/keys/secret_id_key
      #- ./tests/data/keys/ed25519_master_id_secret_key:/var/lib/tor/keys/secret_id_key

version: '2.2'
services:
  relay:
    image: chriswayg/tor-server
    init: true
    restart: always
    network_mode: host
    # ports not needed with network_mode host
    ports:
      #- "9001:9001"
      #- "9030:9030"
      #- "54444:54444"
      #- "7002:7002"
    volumes:
      ## mount custom `torrc` and DataDirectory here
      - ./data/:/var/lib/tor/
      - ./torrc:/etc/tor/torrc
      ## alternatively mount previously saved identity keys here
      #- ./tests/data/keys/secret_id_key:/var/lib/tor/keys/secret_id_key
      #- ./tests/data/keys/ed25519_master_id_secret_key:/var/lib/tor/keys/secret_id_key

Remove ports when net=host is set; removed config dir
Remove ports when net=host is set; removed config dir

