Official Docker for frappe

Hi all,

This is the official docker container for frappe.

Update

  • The 3 Redis servers run on 3 different containers instead of the one container proposed in the earlier version
  • Multisite (DNS Multitenancy) is supported too.

Please try it out and post your reviews on this thread.

7 Likes

Could be a good idea made mariadb data volume as external. This permits make a ‘docker-compose down’ without lose data. The volume must be created before up command, but docker warning you if doesn’t exist.

services:
  mariadb:
    image: "mariadb"
    environment:
      - MYSQL_ROOT_PASSWORD=123
      - MYSQL_USER=root
    volumes:
      - ./conf/mariadb-conf.d:/etc/mysql/conf.d
      - mariadb_data:/var/lib/mysql
    ports:
      - "3307:3307" #mariadb-port
    container_name: mariadb

volumes:
    mariadb_data:
      external: true

Another thing, if you define a .env file with a project name you dont need container_name on dockerfile anymore. Docker creates the containers with project_name + service_name + number (1, 2, 3, etc if you will run various instances) as name.

COMPOSE_PROJECT_NAME=project_name

Ports, an user names, and any dynamic param will be good that goes in that .env file too.

I just trying to parametrize all parameters and execute all steps with an script as entrypoint, but im blocked on erpnext install app because it need to access to mariadb database and it doesnt exist on docker build step.

also super slick would be an ‘official’ LCX/LCD immage and a snap package

3 Likes

Thanks for the suggestions. Are you trying to do bench install-app before docker-compose build/up?

The problem here is that if you do bench install erpnext on build step breaks because it can access to database, and if you do it in a entrypoint , supervisord or circus doesnt have a method for wait for a process, then tries to start app before it finish to download. I only known a way to do this with jwilder dockerize tool [1] and with this im trying now :slight_smile:

I think this is the best way, have frappe dockerized and then install the app (either erpnext or an own application) with entrypoint or similar method in the docker-compose up stage, so the installer is clean and versatile.

I have already frappe part done and parameterized [2] in case you want to check. Don’t use erpnext part because it is not working (nginx and erpnext containers fail where up composer) :stuck_out_tongue: Commented 62-65 lines on dockerfile are the commands to use without dockerize.

[1] GitHub - jwilder/dockerize: Utility to simplify running applications in docker containers
[2] Bitbucket

I make a lot of refactoring and now i am getting this error, appears that frappe cant get erpnext site config but the json is ok :?

erpnext_1         |   File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 156, in install_app
erpnext_1         |     for site in context.sites:
erpnext_1         | TypeError: 'NoneType' object is not iterable
erpnext_erpnext_1 exited with code 1

anyone alive?

Hello! I am preparing to move my development from VirtualBox to Docker on the MacOS Sierra. I have tried to follow the directions from the official GitHub Docker image site: frappe_docker
But I am bumbling around given my absolute ignorance on this matter. I have seen some tutorials and got the hang of basic Docker operations.

This is so far what I understand is necessary to run frappe using Docker.

  1. Install docker for mac :ok:

  2. Create a local folder in macbook pro where I will run the container from :ok:

  3. Open up terminal and cd into the directory created :ok:

  4. Pull the frappe_docker image using:

    docker pull emcniece/frappe_docker :ok:

  5. Build a container linking all these: :sos:

  • Frappe
  • Mariadb
  • redis-cache
  • redis-queue
  • redis-socketio

This is where I get stuck. I can see there are some necessary container configurations regarding ports, links, storage volumes etc. But I am unsure where these configurations go!

Can anybody help finalize a step-by-step guide to get a container running Frappe?

Hi @Tropicalrambler you dont need to pull the frappe_docker image. All you need to do is git clone the official repo frappe_docker, and follow the set of steps mentioned in the README.md . The config shenanigans are taken care off in the process. Please let me know if you have any trouble setting it up.

Vishal, thanks. In one of my steps I had actually cloned the frappe_docker from GitHub and set it up. I will try that same process again. I’ll let you know.

I’ve gotten the docker version up and running and think that this is a great way to deploy ERPNext. With the recent availability of a Windows version of Docker, it makes the software even more accessible.

I am, though, having trouble connecting Navicat to the mariadb docker container. I can start a ‘vanilla’ mariadb docker image and connect to it using Navicat with no problem at all but when I try to connect to the ERPNext mariadb image I get the following error:


I’ve tried the suggestions I was able to find with Google but have not been able to connect.
Does anyone have any suggestions?

Hey @cradford haven’t really worked on Docker for windows, will give it a try today and let you know.

1 Like

Hi @vishal,

i’ve installed successfully on mac …it seems a bit slow, are you experiencing the same?

Thx

Vishal, I’m actually running docker on Ubuntu 16.04 (gnome version w/mate ui) and that’s where I’m getting the error I posted. My objective is to find a way to look through the database to get a better sense of how ERPNext works ‘inside’. If there’s a better tool than Navicat I’d be interested to hear your thoughts.

Same on macOS High Sierra, I’m unable to connect to mysql

Any hint?

Just taking a guess, I am not on a computer to test this now. Try to change mariadb ports in docker-compose from

ports:
      - "3307:3307" #mariadb-port

to

ports:
      - "3307:3306" #mariadb-port

nothing changes …same error

This worked for me (keeping suggested changes in my previous answer and run sudo docker-compose up -d)

Method 1: Use docker localhost IP (172.17.0.1) as host and use port 3307

Method 2: Get the mariadb container’s own IP address and use port 3306

To get the container’s IP:

sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb

Have you run sudo docker-compose up -d after the changes?

I dind’t run the command :grin: Now it works :+1:

Thx

Some assistance needed here!

I have followed the procedures outlined in the README.md, to install on my server which is based on Slackware distro. The fileserver boots from a flashdrive, and runs on a memory-resident root partition. It runs ‘headless’, so all of the installation process has been performed by SSH into the server.

I already have a number of docker containers running on the server, but docker-compose is not included in the standard distribution - therefore I have add the docker-compose binary every time the server boots up.

Having followed all the steps detailed in the README, I am unable to access the frappe interface - telnetting into any of the three exposed ports simply returns “Connection refused”:

peter@Sala ~ $ telnet tower 8000
Trying 172.22.0.100...
telnet: Unable to connect to remote host: Connection refused

However, the mariadb container is accessible (on port 3307, since I already have a mariadb container running on the standard port):

peter@Sala ~ $ telnet tower 3307
Trying 172.22.0.100...
Connected to tower.
Escape character is '^]'.
n
5.5.5-10.2.11-MariaDB-10.2.11+maria~jessi\Qc{`POz���:Pb{ehZl0FO;mysql_native_passwordConnection closed by foreign host.

How can I determine why the frappe container isn’t responding? The container is definitely running - I can ‘docker exec’ into it. ‘ps -eaf’ in the frappe container indicates that no processes, other than bash, are active.

Things which may have been suspicious during the installation procedure:
During ‘docker-compose up -d’, the following messages were displayed (many, more than once):
debconf: delaying package configuration, since apt-utils is not installed
and:
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
and:
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 1.)
debconf: falling back to frontend: Readline

I presume that those are not indicative of problems.

However, the following might be problems:
    Creation of your site - site1.local failed because MariaDB is not properly 
    configured to use the Barracuda storage engine. 
    Please add the settings below to MariaDB's my.cnf, restart MariaDB then 
    run `bench new-site site1.local` again.
and the very last few lines before the cli prompt appeared:
    Wrote js/erpnext-web.min.js - 3.79 KB
    File not found:  /home/frappe/frappe-bench/apps/erpnext/erpnext/public/js/education/student_button.html
    File not found:  /home/frappe/frappe-bench/apps/erpnext/erpnext/public/js/education/assessment_result_tool.html
    Wrote js/erpnext.min.js - 149.33 KB
    Wrote js/item-dashboard.min.js - 7.86 KB
    site1.local does not exist
However, adding the lines to /etc/mysql/my.conf (in the frappe container), running `bench new-site site1.local` and restarting the mariadb container does not resolve the connection issue.
Also, there is no education directory in '/home/frappe/frappe-bench/apps/erpnext/erpnext/public/js'

./bench -s produces the following:
    root@Tower:/mnt/docker/frappe_docker# ./dbench -s
    ls: cannot access 'sites/*/site_config.json': No such file or directory
    127.0.0.1
    127.0.0.1
The message is correct because, although there is a 'common_site_config.json' file in sites, the only child directory is assets and there are no .json files there.

Other points regarding the README file:
There are no details about when or how to alter container configuration - I assumed that I needed to edit the docker-compose.yml file after the ‘git clone’.

Also, the README says: “See deployment for notes on how to deploy the project on a live system.”, but it doesn’t give any clues as to where to find ‘deployment’.