起因

从恩山论坛上看到甜糖官方提供了甜糖星愿的x86版本Docker镜像,加上最近收益基本为0,决定重新部署一下甜糖。

创建macvlan

首先 创建一个macvlan网络

1
docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=ovs_eth0 bridge-host

创建容器

ttnode uid 由 mac 地址和 hostname 决定,mac 地址和hostname 不变,ttnode uid 才能不变。mac 地址是主机地址了,所以指定 hostname 给容器,就可以固定 uid 了。
注意ip 和mac-address地址不能重复!

1
2
3
4
5
6
7
8
9
10
11
docker run -d  -v /volume1/ttnode/cache:/mnt/data/ttnode/.yfnode/cache \
-v /var/run/docker.sock:/var/run/docker.sock \
--name ttnode \
--hostname ttnode \
--ip=192.168.1.91\
--network bridge-host\
--mac-address 54:d6:95:66:ae:41 \
--restart=always \
--privileged=true \
--memory=500m \
registry.cn-hangzhou.aliyuncs.com/tiptime/ttnode:latest