1. Install the software
First installed docker
and docker-compose
, ubuntu directly using apt
docker-compose the software is similar to the role of glue, the equivalent of the file, (multiple) mirrors glued together to use.
Through this software we will be able to link their profiles to clash clash use of docker mirror
2. Prepare the configuration file
The following description from the official
Prepare two documents together, one of which is
config.yaml
the need to replace this file into their clash configuration file, the following examples to the official website
port: 7890
socks-port: 7891
# `allow-lan` must be true in your config.yaml
allow-lan: true
external-controller: 0.0.0.0:8080
Another is the docker-compose
configuration file without changing the file name must docker-compose.yml
be noted that under linux should bridge into a host
version: '3'
services:
clash:
image: dreamacro/clash
volumes:
- ./config.yaml:/root/.config/clash/config.yaml
ports:
- "7890:7890"
- "7891:7891"
# If you need external controller, you can export this port.
# - "8080:8080"
restart: always
# When your system is Linux, you can use `network_mode: "host"` directly.
network_mode: "bridge"
container_name: clash
Wherein explain this line, the colon is the address of the machine in front of the document, after the colon is the mirror image address clash used to do a mapping
./config.yaml:/root/.config/clash/config.yaml
3. Use a mirror
In the two documents exist in the directory, use the command
sudo docker-compose up -d
-d
It indicates that the background to start