Docker Image step-by-step instructions


(dug.armadale@gmail.com) #1

Hello,

I am starting to experiment with the docker image. While I am doing so, I will write step-by-step instructions. I have no previous experience of Docker and little knowledge of Tryton, so I will need help.

The following is a starting point. Would you like me to put this somewhere official?

How to use the Tryton Docker image

First install Docker

  • Install Docker - e.g. on Linux with apt
    • sudo apt install docker.io

Pull the Tryton image

sudo docker pull tryton/tryton

  • Do not know why this had to be done as sudo. Otherwise, I got an error.

Following the brief instructions on https://hub.docker.com/r/tryton/tryton/

“Start a PostgreSQL instance”

sudo docker run --name tryton-postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_DB=tryton -d postgres

  • Again, don’t know why I need sudo

“Setup the database”

sudo docker run --link tryton-postgres:postgres -it tryton/tryton trytond-admin -d tryton --all

  • The following messages will appear and you should enter the details:
    • "admin" email for "tryton": your_email@blah.com
    • “admin” password for “tryton”: a_strong_password

“Start a Tryton instance”

sudo docker run --name tryton -p 8000:8000 --link tryton postgres:postgres -d tryton/tryton

  • Don’t know why I have to sudo.

"You can connect to Tryton using http://localhost:8000/"

  • Use your browser to open http://localhost:8000/
  • A dialogue will open, enter:
    • Database: tryton
    • User name: admin
    • Hit Login
  • A password dialogue will appear.
  • Enter the admin password you created when setting up the database (above).
  • You can logout from the top left icon.

“Start a Tryton cron instance”

This is the dedicate cron part of the server (http://manpages.ubuntu.com/manpages/bionic/man1/trytond-cron.1.html).

sudo docker run --name tryton-cron --link tryton-postgres:postgres -d tryton/tryton trytond-cron -d tryton

  • Same question about sudo.

“Command arguments”

There in a note on the Docker page that might be of interest if you know Docker.

" Since the 4.6 series, if COMMAND starts with a - , it is appended as argument to the default COMMAND. To see all arguments available run:"

$ docker run --rm -ti tryton/tryton --help

Restarting containers after shutdown

On the Linux system I used the docker containers are available to all users who have sudo privileges.

You can view all currently installed containers using:

sudo docker container ls --all

OR

sudo docker ps --all

To start Tryton you would need to start the three containers associated with it:

sudo docker start tryton-postgres tryton tryton-cron

The order above is important in the sense that tryton-postgres must be started before the other two (as they need to have it running in order to connect to it).


The above is a start. Could you tell me if the docker image is for experimenting with or can it be used as a basis of a real system?

Kind regards,

Douglas


(Sergi Almacellas Abellana) #2

You probably need to set the sudo on all comands because your user does not belong to the docker group. This is explained on the post installation steps of the docker manual.