Back

kali - run wechat with docker

发布时间: 2023-02-11 08:37:00

refer to:  https://leimao.github.io/blog/Docker-WeChat/

1. create Dockerfile

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential \
        ca-certificates \
        locales \
        locales-all \
        gnupg \
        locales \
        locales-all \
        fcitx-libs-dev \
        fcitx-bin \
        fcitx-googlepinyin \
        fcitx \
        fcitx-ui-qimpanel \
        fcitx-sunpinyin \
        dbus-x11 \
        im-config
RUN apt-get clean

# [UbuntuKylin](https://www.ubuntukylin.com/) is a Chinese Ubuntu derivative.
RUN echo "deb http://archive.ubuntukylin.com/ubuntukylin focal-partner main" > /etc/apt/sources.list.d/wechat.list && \
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 56583E647FFA7DE7

RUN apt-get update && apt-get install -y --no-install-recommends \
        weixin \
        language-pack-zh* \
        chinese* \
        fonts-wqy-microhei \
        fonts-wqy-zenhei \
        xfonts-wqy
RUN apt-get clean

ENV LC_ALL zh_CN.UTF-8
ENV LANG zh_CN.UTF-8
ENV LANGUAGE en_US.UTF-8

ENV GTK_IM_MODULE=fcitx
ENV QT_IM_MODULE=fcitx
ENV XMODIFIERS=@im=fcitx
ENV DefaultIMModule=fcitx

CMD ["weixin", "--no-sandbox"]

2. $ docker build -f wechat.Dockerfile --tag=wechat:0.0.1 .

3. run docker: 

$ xhost +
$ docker run \
    -it \
    --rm \
    --ipc=host \
    -e DISPLAY=$DISPLAY \
    -e XMODIFIERS=@im=fcitx \
    -e QT_IM_MODULE=fcitx \
    -e GTK_IM_MODULE=fcitx \
    -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
    -v $HOME/.config/weixin:/root/.config/weixin \
    wechat:0.0.1
$ xhost -

4. scan and login

在web正常登录的,在docker环境下也可以正常登录,
在web无法正常登录的,在docker下面也不能登录
而且据说docker下无法使用输入法。额。。。

Back