This Dockerfile contains the steps required to build a working image of Tryton server. The build is based on the official Debian base image on Dockerhub and packages from Debian Tryton Maintainers.
The image provided by this Dockerfile is a minimalistic Docker container for Tryton server
- that works out of the box,
- follows best practices for Dockerfiles,
- is meant to be extended to fit your personal needs. For further steps see below.
The Tryton Server image is built automatically from GitHub.
If you don't have yet a running docker installation, install first docker
with
sudo apt-get install docker.io
Add the user, that will use docker, to the docker group
sudo useradd myuser docker
Note: You may have to relogin before the group settings will take effect.
Fetch the repository from docker
sudo docker pull mbsolutions/tryton-server
Note: To fetch and work with specific versions add the relative tag to the command like
sudo docker pull mbsolutions/tryton-server:4.6
Run a new container using the image
sudo docker run -d -p 8000:8000 mbsolutions/tryton-server
- The
-d
option indicates that the container should be run in daemon mode. - The
-p
option and it's value8000:8000
instructs docker to bind TCP port 8000 of the container to port 8000 on the host. For more options on binding the interfaces of containers to the host machine see the ports documentation.
The creation of new databases is done with trytond-admin
inside the container.
For more information have a look at the documentation of the
Debian package.
This image image uses several environment variables which are not required, but may significantly aid in using the image.
This environment variable can be used to set the database connection.
Use "-e TRYTOND_DATABASE_URI=postgresql://user:password@localhost:5432/" in "docker run".
You can access the docker container and work from within it.
sudo docker exec -it mbsolutions/tryton-server /bin/bash
On execution of the command a new prompt within the container should be available to you.
This docker image is a minimal base on which you should extend and write your own.
If you would like to do additional initialization before
the startup of the server
in an image derived from this one, add an *.sh
script under /docker-entrypoint-init.d
.
The entrypoint script will source any *.sh
script found in that directory
to do further initialization before starting the service.
The following example steps would be required to say make your setup work with postgres and install the sale module. In case you want install all available modules use tryton-modules-all instead.
# Tryton Server with Sale module and Postgres
FROM mbsolutions/tryton-server:4.6
MAINTAINER Mathias Behrle <[email protected]>
# Install additional distribution packages
RUN apt-get update && apt-get install -y \
tryton-modules-sale \
&& rm -rf /var/lib/apt/lists/*
# Get a [sample trytond.conf](https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=tryton/tryton-server.git;a=blob_plain;f=debian/trytond.conf;hb=refs/heads/debian),
# copy it to the directory of your Dockerfile,
# adjust the settings to your needs (e.g. connection parameters and credentials to your PostgreSQL server)
# and copy it into the container with
COPY trytond.conf /etc/tryton/trytond.conf
This image was built by MBSolutions.
Parts of the setup were adopted from
For any questions about this image and your docker setup contact us at support.