Sign inSign up

sievelau/xray-core

By sievelau

•Updated almost 3 years ago
Archived

Image
0

342

sievelau/xray-core repository overview

⁠Before Run

If you want to use geoip and/or geosite for routing, you should prepare them ahead. By default, this image set the following environment variables to /etc/xray for xray binary to find the files (Keep in mind that the /etc/xray folder is the one inside the container):

  1. XRAY_LOCATION_ASSET, which makes xray search for geoip.dat and/or geosite.dat in /etc/xray instead of the folder containing the binary
  2. XRAY_LOCATION_CONFIG, which makes xray search for config.json in /etc/xray
  3. XRAY_LOCATION_CONFDIR, which makes xray tries to combine all json files in /etc/xray into a final config for runtime

More information on xray's env config, see env⁠.

⁠Run

Get your config files and additional data files (e.g. geoip.dat) ready, for example:

./
└ config
    ├── config.json
    └── geoip.dat

Now make a docker-compose.yaml:

version: '3'

services:
  xray-core:
    image: sievelau/xray-core:latest
    restart: always
    # choose one mode, if you use host network, don't map ports
    network_mode: host
    # But if you comment out the previous line and use docker network
    # Remeber that tcp and udp need seperate lines
    # ports:
    #   - 443:443/tcp
    #   - 443:443/udp
    volumes:
      # mount the config dir into the container
      - ./config:/etc/xray:ro
     # Mount the ssl certificate directory into the container, for protocols like xtls
      - /etc/letsencrypt:/etc/letsencrypt:ro
    # Set a container name, so in scripts you can simply docker restart xray-core without specifying the long ID
    container_name: xray-core
    # Just for example
    environment:
      - XRAY_LOCATION_ASSET=/etc/xray

Well to go now.

Tag summary

Content type

Image

Digest

sha256:9296450e3…

Size

12.5 MB

Last updated

almost 3 years ago

docker pull sievelau/xray-core