This is repository for scripts building a Docker image for Socks5BalancerAsio using Alpine linux image for minimal size (~20 MB).
See on DockerHub: fossforreal/socks5balancerasio
Currently image on DockerHub was built and tested for
amd64
(taglatest, latest-amd64
) architecture.Other
arm64, arm/v7
are available with tagslatest-arm64, latest-arm-v7
, but were not tested.
git clone https://github.com/Socks5Balancer/Socks5BalancerAsio
cd Socks5BalancerAsio
cp example-config/FullConfig.json config.json
docker run -v $(pwd)/html:/html -v $(pwd)/config.json:/config.json \
-p 5000:5000 -p 5002:5002 -p 5010:5010 -it fossforreal/socks5balancerasio:latest
Or if you prefer docker-compose
:
Replace /path/to
with directory containing /html
and valid config.json
(see in cloned repo as shown above).
And save following into docker-compose.yml
(or use file from this repo):
version: '2'
services:
socksbalancer:
container_name: socksbalancer
# You can also use ":latest-arm64" or ":latest-arm-v7"
image: fossforreal/socks5balancerasio:latest-amd64
restart: always
volumes:
# If you do not use Embedded Web Server, exclude "/html"
- /path/to/html:/html
- /path/to/config.json:/config.json
ports:
- 5000:5000
- 5002:5002
- 5010:5010
Then you can start with docker-compose up -d
and stop docker-compose down
.
IMPORTANT!
For configuration options scroll down and read section # Configuration
, also check Socks5BalancerAsio README.md
Image with tag "v1.1" or "latest" uses Boost v1.77, while "v1.0" uses Boost v1.73.
Scripts do the following:
- Download sources for building (Boost 1.74+ and fossforreal/Socks5BalancerAsio v1.1
Boost-1.73.0 and Socks5BalancerAsio-1.0) - Build "builder" alpine image
- Build
Boost libs andSocks5BalancerAsio using it - Build "runner" alpine image with stripped binary
- Provide you with an image and command to use it
All of this is available for amd64, arm64, arm/v7
architectures (see # Other architectures
).
To use Boost v1.73 and previous version checkout this repo at tag v1.0, i.e. commit - d76346b2631cdc39221d40013fb9ab76e6d4ced1.
Warning!
If sources are not downloading or you have problems with file permissions assume that this should be running in Docker with
root
priviledges.Also you should have following utils:
wget, git, docker
(tar, bzip2
only for Boost-1.73)Keep in mind that compilation uses all cores
make -j$(nproc)
, so make sure not to burn your CPU.
- Clone repository:
git clone https://github.com/fossforreal/Socks5BalancerAsio-Docker
- Run script:
chmod +x ./alpine-build.sh && ./alpine-build.sh
- Then you will have Docker image
socks5balancerasio:latest
- You can run it interactively like this (or if in background, replace
-it
with-d
:
docker run -v $(pwd)/html:/html -v $(pwd)/config.json:/config.json \
-p 5000:5000 -p 5002:5002 -p 5010:5010 -it socks5balancerasio
Prerequisites: Docker installed with BuildX plugin (on Debian, Redhat, Arch it is by default, see Docker Docs)
Same thing as amd64
but use other script (it builds amd64, arm64, arm/v7
):
chmod +x ./multiarch-alpine-build.sh && ./multiarch-alpine-build.sh
After that you will have Docker images socks5balancerasio:latest-{amd64,arm64,arm-v7}
.
- Clone repository (you need
html
folder andconfig.json
) into somewhere (may be/tmp
): - Adjust
config.json
- Run image
docker run -v $(pwd)/html:/html -v $(pwd)/config.json:/config.json \
-p 5000:5000 -p 5002:5002 -p 5010:5010 -it socks5balancerasio:latest
Ports you need to publish (i.e. 5000,5002,5010
...) come from config options:
...
"listenPort": 5000,
"stateServerPort": 5010,
"EmbedWebServerConfig": {
...
"port": 5002,
...
},
"multiListen": [
... {
"port": 6010,
} ...
]
...
To be able to publish (and access) these ports you should have options set as follows:
...
"listenHost": "0.0.0.0",
"stateServerHost": "0.0.0.0",
"EmbedWebServerConfig": {
...
"host": "0.0.0.0",
...
}
...
and if you have multiListen
option as well:
"multiListen": [
... {
"host": "0.0.0.0",
} ...
]
...
If my work somehow helped you, consider crypto donation in XMR (Monero) to this address:
84oCTQkSHL1AQMsGHWeJG6H3SdScdTCHpFsK75y4rms2KwtMkH3fSECJ3jiD5PVpJaQtKhtUDZANvb8DfV6iY6VrJ6xLkdA
(c) fossforreal, GNU GPLv3