docker基于debian11基础环境制作包含libreoffice的镜像

48 篇文章 2 订阅
  1. 首先下载指定版本的libreoffice,注意debian11下需要选择Linux (64-bit) (deb)

    官方下载地址:https://www.libreoffice.org/download/download-libreoffice/?type=deb-x86_64&version=7.6.2&lang=zh-CN

  2. 将文件上传到服务器并解压缩备用,目录结构如下:

    - LibreOffice_7.6.2.1_Linux_x86-64_deb
    	- DEBS
    		- xxx.deb
    	- readmes
    
  3. 准备基础镜像,我这里使用的是包含aspnet的基础镜像,当然是debian11,执行如下命令:

    docker run --name dotnet-libreoffice-test -it --rm mcr.microsoft.com/dotnet/aspnet:6.0 bash
    
  4. 在容器内部,首先更新apt仓库:

    mv /etc/apt/sources.list /etc/apt/sources.list.bak
    
    echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free" >/etc/apt/sources.list
    echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free" >>/etc/apt/sources.list
    echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free" >>/etc/apt/sources.list
    echo  "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free" >>/etc/apt/sources.list
    
    apt-get update
    
  5. 安装java运行环境,注意,现在默认支持的长期版本为11,所以apt-get下安装的是11版本:

    apt install default-jre
    
  6. 安装cairo

    apt-get install libcairo2
    

    有的基础镜像还需要额外安装python-cairo,当然我们不需要。

  7. 安装其他工具[top、ps、curl、ping等],可选

    # 安装ps top
    apt-get install procps
    # 安装curl
    apt-get install curl
    # 安装ping
    apt-get install iputils-ping
    # 安装vi
    apt-get install vim
    
  8. 将LibreOffice_7.6.2.1_Linux_x86-64_deb复制到容器内部

    docker cp ./LibreOffice_7.6.2.1_Linux_x86-64_deb dotnet-libreoffice-test:/
    
  9. 下面进行安装,官方安装文档:https://wiki.documentfoundation.org/Documentation/Install/Linux/zh-cn

    cd /LibreOffice_7.6.2.1_Linux_x86-64_deb/DEBS
    
    dpkg -i *.deb
    
  10. 为LibreOffice安装字体【可选】

    仅安装中文字体,下载中文字体包:http://kkfileview.keking.cn/fonts.zip,解压后放在容器内的/usr/share/fonts目录下。

    安装微软的Office字体,将windows下C:\Windows\Fonts打包,解压后放在容器内的/usr/share/fonts目录下即可。

    注意不是放目录,放解压后的所有文件,比如C:\Windows\Fonts下有Arial字体,我们要做的就是把Arial字体放到容器内的/usr/share/fonts目录下。

  11. 清空本次登入的所有输出命令

    history -c
    
  12. 再开另外一个窗口,进行容器的提交

    docker commit dotnet-libreoffice-test aspnet-libreoffice:6.0
    

这时候我们的镜像就制作好了,镜像名为aspnet-libreoffice:6.0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

L-960

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值