Multiple Erpnext With Docker

Hi everyone,

I’m currently trying to have multiple docker container installed with erpnext on the same server, I’ve read quit a few post, but none of them seeems to be working. The docker-compose branch from ianneub doesnt work either.

Any ideas on how should i implement this with erpnext on different port through nginx or different domains ?

Thanks all

Docker worked for me, though running in a single container

Hi @RWEMA_Aimable,

Thanks for your advice, but i already have a docker erp container runs on ubuntu. What im trying to do it having multiple container run in one server at the sme time. I believe i have to use some sort of reverse proxy and change the config file for nginx.

Does anyone have any experience with this ?

So far, I’m following dockerfile similar to davidgu’s, have EXPOSE 80 8000.

I had one erp up and running on 80
docker run -d -p 80:80 -p 8000:8000 --name erpnext --volumes-from erpdata erp

and as i try to create another container with
docker run -d -p 86:86 -p 8080:8080 --name erpnext1 --volumes-from erpdata erp

I’m getting internal server error trying to accessing the one on 86 (http://localhost:86)

After, I went under “frappe-bench” in the container and did
$ bench set-nginx-port site1.local 86
$ bench setup nginx
$ sudo service nginx reload

http://localhost:86 still give internal server error

Any suggestions?

This may be what you want GitHub - nginx-proxy/nginx-proxy: Automated nginx proxy for Docker containers using docker-gen

Try this

docker run -d -p 86:80 -p 8080:8000 --name erpnext1 --volumes-from erpdata erp

Hi @RWEMA_Aimable,

I just tried this, still internal server error.

And i used set-nginx-port 86, site became unavaliable

I also tried to have erpnext on 86 first

$ docker run -d -p 86:86 -p 8080:8080 --name erpnext1 --volumes-from erpdata erp
$ docker exec -it erpnext1 /bin/bash
$ bench set-nginx-port site1.local 86
$ bench setup nginx
$ sudo service nginx reload

This allows me to access erpnext at localhost:86, but as i install another erpnext on 80

$ docker run -d -p 80:80 -p 8000:8000 --name erpnext --volumes-from erpdata erp

the port 80 one doesnt work

I think this proxy is better for what you want: GitHub - nginx-proxy/nginx-proxy: Automated nginx proxy for Docker containers using docker-gen
With this you don’t need to publish the exposed ports. Reverse proxy is based on subdomain and you add 2 virtual env : VIRTUAL_HOST and VIRTUAL_PORT and you can let nginx run on port 80 for all your instances

Hi @RWEMA_Aimable
Mind if I ask how this process works? I actually dont know much about reverse proxy.

After I setup another container for reverse proxy, how should i change up the config file in my other two erpnext containers? or should the “docker run” command be different?

Much appreciated !!

Basically you access your instances using wildcard subdomains, for example erpnext1.local, erpnext2.local, … erpnextN.local.
You will need to launch N erpnext instances, all exposing port 80 but don’t publish it, this will be the proxy’s job.
Each instance should have and ENV variable - VIRTUAL_HOST=erpnextN.local
Of course you need to point you subdomain to your server IP.

But can’t you just use multisite feature to do the same?

version: '2'
services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

  erpnext1:
    image: your_erpnext_image
    container_name: erpnext_1
    environment:
      - VIRTUAL_HOST=erpnext1.local
  erpnext2:
    image: your_erpnext_image
    container_name: erpnext_2
    environment:
      - VIRTUAL_HOST=erpnext2.local

Thank you so much for your reply.

I did try with multisite first, but as i want to make changes to erpnext, i noticed all sites share the same erp app.

Much appreciated

i’m wondering if can i do it with different port ? Just simply because its much easier to test out.

This a docker container for frappe, have a go at it.

Would love your feedback on this thread :