How to self host Libre Translate on docker compose

Unlike Lingva the proxy for google translate, Libre Translate uses Argos Translate which is an actual translate engine. It has it's own engine and it's own AI and API for translations so weather you are an application owner want free API or normal user want to escape the bubble of google translate, you came to the right application :)

It's easy to host it but before I start I will assume that: * You are running debian 11 * You already have a VPS: * Your linux distro is up-to-date (sudo apt update && sudo apt upgrade) * You have a domain name: * Have sudo access or root account * Already installed docker and docker-compose: * Already installed Nginx: * Already have a reverse proxy conf file: * Already have certbot to issue cert:

System Requirements


Changes in DNS (domain side)

You really do not need to add any dns entries except if you want to create subdomain for this container then you go in your domain's dns panel and add either CNAME entry that looks like and make it's target the root domain or A entry with and make it's target the IP of your VPS

Libre translate docker-compose file

We need a docker-compose.yml file so we can start Libre translate, for me I use this file:

version: "3"

    container_name: libretranslate
    #build: .
    image: libretranslate/libretranslate
    restart: unless-stopped
    ## Uncomment above command and define your args if necessary
    command: --frontend-language-source en --frontend-language-target ar

Optional stuff to change: The IP and port number for Libre translate (so we can use it later for nginx to reverse proxy it) command: Is configuration for Libre translate, to know more args or commands to add in libre translate, please visit:

Spin it up!

Now after we done editing, and everything is cool. We need to run our container so just run:

docker-compose up -d

the -d option does not let docker post logs of running application but if you want to see logs you can run:

sudo docker-compose logs -f -t

To check if there any weird behaviors or errors


Now after we make sure it's running well. We need to serve it over the internet (called reverse proxy) so without much talk, here is our server block for Libre translate:

server {
        listen [::]:80;
        listen 80;
        server_name [domain name] ;

       location / {
               include /etc/nginx/reverse-proxy.conf;

server_name: Change this to match domain name of libre translate include: is our reverse proxy file proxy_pass: the IP and port of our running docker image

After this you should be up and running for Libre translate! :) just do not forget to run certbot --nginx to make it secure with https://

Update it

Of course after some time the image will be outdated and you need to update and what I love about docker that it's easy to update, really just to do it run:

docker-compose down && docker-compose pull && docker-compose up -d

What it does is: 1) Stops the container, 2) Pull last update (download last update) and 3) Re-run the container back!


If you use firewall (ufw for example) you really do not need any ports other than 443 and 80 as we use nginx reverse proxy

#howto #selfhost #docker