A collection of bash scripts to deploy and manage ERPNext on Docker Compose. The scripts handle the full lifecycle — from initial setup to custom image builds and deployments.
Install Docker Engine on Ubuntu: https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
1. Clone and prepare
git clone https://github.com/clicktrend/erpnext_docker_scripts.git
cd erpnext_docker_scripts
chmod +x scripts/*2. Initialize the project
scripts/setup.shOn first run, a .env file is created. Review and adjust the values, then set INSTALLED=true and run the script again:
scripts/setup.shThis creates the .configs directory and clones frappe_docker into .frappe_docker.
The deployment consists of three independent stacks that must be set up in order.
scripts/traefik-setup.sh # configure domain, email, and admin password
scripts/traefik-docker.sh up # start TraefikPoint your DNS to the domain you entered. The Traefik dashboard is available at that domain — log in with admin and the password you set.
scripts/mariadb-setup.sh # generate database password
scripts/mariadb-docker.sh up # start MariaDBTo reinstall from scratch, delete the MariaDB volume before starting.
scripts/erpnext-setup.sh # generate ERPNext configuration
scripts/erpnext-docker.sh up # start ERPNext containers
scripts/erpnext-create-site.sh # create the ERPNext site (first time only)Verify in the Traefik dashboard that the ERPNext router has been registered.
Apps are defined in apps.json and baked into the Docker image at build time. Private repos (e.g. GitLab) require an SSH deploy key.
Once on the server:
ssh-keygen -t ed25519 -C 'erpnext-build-deploy-key' -f .configs/deploy_key -N ''
cat .configs/deploy_key.pubAdd the printed public key as a read-only Deploy Key in GitLab under
Settings → Repository → Deploy keys.
The private key at .configs/deploy_key is automatically picked up by scripts/erpnext-custom-setup.sh as a Docker BuildKit secret — it is never baked into the image.
scripts/erpnext-custom-setup.sh # build the custom image and generate compose config
scripts/erpnext-docker.sh down
scripts/erpnext-custom-docker.sh upTo release a new version:
- Pull latest scripts and update the frappe_docker fork:
scripts/update.sh
- Update
apps.jsonif app versions changed - Bump
ERPNEXT_CUSTOM_TAGin.env - Build and regenerate the compose config:
# Standard build (uses Docker cache — fast, but may skip new app commits): scripts/erpnext-custom-setup.sh # Fresh build (no cache — picks up latest git commits from all apps): scripts/erpnext-custom-setup.sh --fresh
Use
--freshwhenever you pushed new commits to a custom app (e.g.adomio). Without--fresh, Docker may reuse the cached git-clone layer and miss your changes. - Restart ERPNext:
scripts/erpnext-custom-docker.sh restart
- Run migrations and rebuild assets:
scripts/erpnext-backend.sh bench migrate scripts/erpnext-backend.sh bench build
- Restart again to apply the build:
scripts/erpnext-custom-docker.sh restart
Each stack supports up, down, logs, and restart:
scripts/traefik-docker.sh up|down|logs|restart
scripts/mariadb-docker.sh up|down|logs|restart
scripts/erpnext-custom-docker.sh up|down|logs|restartUse erpnext-backend.sh to run bench inside the running backend container:
scripts/erpnext-backend.sh bench --site erp.example.com list-apps
scripts/erpnext-backend.sh bench --site erp.example.com install-app hrms
scripts/erpnext-backend.sh bench --site erp.example.com migrate
scripts/erpnext-backend.sh bench --site erp.example.com build