一、Host模式

拉取镜像

docker pull onething1/wxedge

启动容器

docker run -d --name=wxy --restart=always --privileged --net=host  --tmpfs /run --tmpfs /tmp -v /home/qiang/data/wxy:/storage:rw  onething1/wxedge

docker-compose.yaml

version: '3'
services:
  wxy:
    image: onething1/wxedge:latest
    container_name: wxy
    restart: always
    privileged: true
    network_mode: "host"
    tmpfs:
      - /tmp
      - /run
    volumes:
      - /home/qiang/data/wxy:/storage:rw

访问地址

http://192.168.1.206:18888

二、MacVlan模式

创建macvlan网络

docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=wlp2s0b1 docker_network
ip link add server_network link wlp2s0b1 type macvlan mode bridge
ip addr add 192.168.1.45 dev server_network
ip link set server_network up
ip route add 192.168.1.66 dev server_network

docker-compose.yaml

version: '3'
services:
  wxy:
    image: onething1/wxedge:latest
    container_name: wxy
    hostname: wxy
    restart: always
    privileged: true
    tmpfs:
      - /tmp
      - /run
    volumes:
      - /home/qiang/data/wxy:/storage:rw
    networks:
      default:
        ipv4_address: 192.168.1.66
networks:
  default:
    external:
      name: docker_network

访问地址

http://192.168.1.66:18888