Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
docs(docker): 可视化运行Libreoffice
Browse files Browse the repository at this point in the history
  • Loading branch information
zjZSTU committed Sep 25, 2019
1 parent a42a5fc commit 71897d4
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
8 changes: 8 additions & 0 deletions docs/source/docker/gui.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

可视化运行
=========================================

.. toctree::
:maxdepth: 2

gui/[Docker][Ubuntu]Libreoffice运行
67 changes: 67 additions & 0 deletions docs/source/docker/gui/[Docker][Ubuntu]Libreoffice运行.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

# [Docker][Ubuntu]Libreoffice运行

参考:[【微信分享】林帆:Docker运行GUI软件的方法](https://www.csdn.net/article/2015-07-30/2825340)

利用`Docker`容器可视化运行`Libreoffice`

## 构建

下载[libreoffice/Dockerfile](https://github.com/jessfraz/dockerfiles/blob/master/libreoffice/Dockerfile)

```
FROM alpine:latest
LABEL maintainer "Jessie Frazelle <jess@linux.com>"
RUN apk --no-cache add \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
libreoffice \
ttf-dejavu
ENTRYPOINT [ "libreoffice" ]
```

执行构建命令

```
$ docker build -t jess/libreoffice .
```

生成镜像`jess/libreoffice`

## 配置

使用`xhost`命令允许所有用户访问`X11`服务

```
$ sudo apt-get install x11-xserver-utils
$ xhost +
```

## 运行

```
docker run -d \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v $HOME/slides:/root/slides \
-e GDK_SCALE \
-e GDK_DPI_SCALE \
--name libreoffice \
jess/libreoffice
```

即可启动`libreoffice`,其操作文件可放置于`$HOME/slides`文件夹

![](./imgs/libreoffice.png)

关闭`libreoffice`后可再次重新启动:

```
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9ea0bd8bd9f9 jess/libreoffice "libreoffice" 57 seconds ago Exited (0) 6 seconds ago libreoffice
$ docker start 9ea0
9ea0
```
Binary file added docs/source/docker/gui/imgs/libreoffice.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/source/docker/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ docker使用指南
:maxdepth: 2

basic
advanced
dockerfile
advanced
gui

FAQ

Expand Down

0 comments on commit 71897d4

Please sign in to comment.