Skip to content

rming/unoserver-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

132 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unoserver Container Image

Container image for unoserver

The environment

This Container image uses Alpine Linux as a base image and provides:

  • LibreOffice

  • unoserver

  • Fonts (Alpine packages)

    • font-noto

    • font-noto-cjk

    • font-noto-extra

    • terminus-font

    • ttf-font-awesome

    • ttf-dejavu

    • ttf-freefont

    • ttf-hack

    • ttf-inconsolata

    • ttf-liberation

    • ttf-mononoki

    • ttf-opensans

How to use it

Note
The docker can normally be replaced with podman as well.

In interactive mode

Just run:

docker run -it -v <your directory>:/data/ ghcr.io/unoconv/unoserver-docker

After you start the container, you can use unoconvert command to convert documents using LibreOffice.

or to convert directly using unoconvert:

docker run -it -v <your directory>:/data/ ghcr.io/unoconv/unoserver-docker unoconvert /data/document.docx /data/document.pdf

Docker maps your directory with /data directory in the container.

You might need to add the option :z or :Z like <your directory>:/data/:z or <your directory>:/data/:Z if you are using SELinux. See Docker docs or Podman docs.

In non-interactive (remote) mode

docker run -p 2003:2003 ghcr.io/unoconv/unoserver-docker

After you start the container, you can use unoconvert command to convert documents using LibreOffice.

Note
You must use --host-location otherwise unoconvert will default to local although running unoserver in a container should be handled as remote.
unoconvert --host-location remote example.docx example.pdf

Configuration

Environment Variables

You can configure unoserver behavior using environment variables. If an environment variable is not set, the corresponding parameter will not be passed to unoserver (using unoserver’s default behavior).

Environment Variable Default Value Description

CONVERSION_TIMEOUT

not set

Maximum time in seconds to wait for a conversion to finish. If not set, unoserver uses its default.

STOP_AFTER

not set

Number of conversions after which unoserver will stop (to avoid memory leaks). If not set, unoserver runs indefinitely.

Example usage

# Set conversion timeout to 120 seconds and stop after 500 conversions
docker run -p 2003:2003 -e CONVERSION_TIMEOUT=120 -e STOP_AFTER=500 ghcr.io/unoconv/unoserver-docker
# Only set conversion timeout, let unoserver use its default for stop-after
docker run -p 2003:2003 -e CONVERSION_TIMEOUT=180 ghcr.io/unoconv/unoserver-docker
# Use unoserver defaults for all parameters
docker run -p 2003:2003 ghcr.io/unoconv/unoserver-docker

FAQ

  1. Why do I get an error during when converting is writing/exporting to file?

  2. It’s very likely that you haven’t given the container write permission to the mounted data directory. See: Issue #44

How to contribute / do it yourself?

Requirements

You need the following tools:

  • A bash compliant command line

  • Docker installed and in your path

How to build

docker build .

About

Docker files for a dockerized unoserver

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Shell 55.7%
  • Dockerfile 44.3%