debian9.9(linux)使用docker方式使用微信和QQ(简单先进)

在linux上使用微信和QQ并不算什么新鲜事,之前采用wine,github,crossover,snap等的方式都安装过,其中最方便的还是github上的下载,然后双击运行,就可以了,但是它貌似已经不维护了,github上的更新时间是2年前,而且我觉得现在使用docker的方式也比那个好一点。

docker客户端给docker守护进程发送命令,docker守护进程从远端的仓库中获取镜像,使用镜像创建一个容器,客户端就可以使用命令操作这个容器。这个镜像怎么来的呢?就是把一个应用除内核外的所有运行环境打包,所以它的移植性非常好。

先展示一下我的安装结果:

docker分企业版(docker-ee)和社区版(docker-ce) ,我们自己玩就安装社区版就可以了。

我的系统是:

guoyz@debian:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.9 (stretch)
Release:	9.9
Codename:	stretch

1,修改源

guoyz@debian:~$ cat /etc/apt/sources.list
deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib

deb [arch=amd64] https://download.docker.com/linux/debian stretch stable

2, 可以使用国内其它源,修改完之后,更新一下:

guoyz@debian:~$ sudo apt-get update 

3,安装一些必备软件包

guoyz@debian:~$ sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

4,将Docker存储库添加到APT源(第一步中包含了)

guoyz@debian:~$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

之后,sudo apt-get update更新一下包列表

5,安装docker-ce

guoyz@debian:~$ sudo apt-get install docker-ce

6,检查是否运行,就想linux的其它服务一样,看到active就是在运行了

guoyz@debian:~$ sudo systemctl status docker
[sudo] guoyz 的密码:
0000000000000000000000000000000000000000000000000000000000
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e
   Active: active (running) since Sat 2019-07-06 11:02:49 CST; 5h 33min ago
     Docs: https://docs.docker.com
 Main PID: 738 (dockerd)
    Tasks: 15
   Memory: 57.9M
      CPU: 6.649s
   CGroup: /system.slice/docker.service

下面这步可以不做(第7步),就是为了不用在docker前面加sudo来使用docker,就是为了方便。默认情况下,该docker命令只能由root用户或docker组中的用户运行,该用户在Docker的安装过程中自动创建。

7,将用户USER添加到docker组中

guoyz@debian:~$ sudo usermod -aG docker ${USER}

8,把镜像pull到本地

guoyz@debian:~$ docker pull bestwu/qq

这个估计要等几分钟了。

9,启动qq(第一次需要这样,创建容器)

docker run -d --name qq --device /dev/snd/ -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME/TencenFiles:/TencentFiles -e DISPLAY=unix$DISPLAY -e XMODIFIERS=@im=fcitx -e QT_IM_MODULE=fcitx -e GTK_IM_MODULE=fcitx -e AUDIO_GID=`getent group audio | cut -d: -f3` -e VIDEO_GID=`getent group video | cut -d: -f3` -e GID=`id -g` -e UID=`id -u` bestwu/qq:im 

之后会出现登陆界面。

10,查看本地有哪些容器

guoyz@debian:~$ docker ps  -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
76ebee5f0fa0        bestwu/wechat       "/entrypoint.sh"    18 hours ago        Up 6 hours                              wechat
a110eba9afc7        bestwu/qq:im        "/entrypoint.sh"    18 hours ago        Up 6 hours                

11,可以使用CONTAINER ID来启动容器

guoyz@debian:~$ docker start a110eba9afc7 

12,微信的安装也是一样的,如果安装不成功的,请参考下面两个链接。

 

docker的功能非常强大,自己去挖掘。

参考1:https://hub.docker.com/r/bestwu/qq

参考2:https://cloud.tencent.com/developer/article/1360720

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章