How to update Docker version of ERPNext

Hi,
I am using the Docker version of the ErpNext here:

I noticed that it is using this versions:
erpnext 13.x.x-develop
frappe 13.x.x-develop

My question is:
If there are new updates on frappe and erpnext, what do I need to do? Do I just download the new docker image?

I noticed that the bench installed is also incomplete, it does not have the “bench update” functionality.

thanks,
Dicky

Set the VERSION environment variable to change version, more here : https://github.com/frappe/frappe_docker/blob/develop/docs/single-bench.md#setup-environment-variables

Thanks for the reply. After I set the VERSION variable, do I just restart the docker containers again?

Yes.

If you’ve not used docker before, it will be difficult to setup further. Do a basic docker tutorial before trying it out for ERPNext.

If you’re on dev version, you can’t go back. Restart with fresh install

Yes
I managed to get the docker version running, but I see what you meant. Better to start with some fixed version initially than to go with dev.

Thanks

1 Like

I’m fairly new to docker and ERP Next. I needed to update my instance running in docker and couldn’t find any detailed guides. After going in circles and starting again many times, I finally got this working.

Note that I had installed ERP next using the Easy-Install.py method, however I think this should work for a standard docker install (Please someone correct me if I am wrong here). It should also be noted that that was an upgrade from version 15.39.3 of ERPNext and 15.45.1 of FRAPPE to versions 15.42.0 and 15.47.2 respectively:

How to update self-hosted ERPNext running in docker

Note that this guide was specifically put together for an ERPNext install that was done using the easy-install.py script.

1. BACKUP YOUR DATA

I cannot stress this point enough. Please make sure you have a backup of your data before running any updates. I won’t go in to the steps most environments differ. In my case, I am running docker on ubuntu which is itself running as a virtual machine. I created a checkpoint of the machine before running the upgrade but have full backups as well.

2. Copy the docker compose file (We’ll need this in a bit)

Navigate to your home directory (Usually /home/username)

Locate the docker compose file that was created as part of the initial install. It should be called something like ‘yourproject-compose.yml’

Copy this to the frappe_docker folder

cp yourproject-compose.yml /home/yourusername/frappe_docker

3. Edit the environment file

Navigate to the frappe_docker folder that was initially created. Usually located in /home/yourusername/frappe_docker

Once in said folder, edit the .env file

sudo nano .env

It should look something like this:

ERPNEXT_VERSION=v15.39.3
FRAPPE_VERSION=v15.45.1
DB_PASSWORD=a04f78537
DB_HOST=db
DB_PORT=3306
REDIS_CACHE=redis-cache:6379
REDIS_QUEUE=redis-queue:6379
REDIS_SOCKETIO=redis-socketio:6379
LETSENCRYPT_EMAIL=youremail.domain.com
SITE_ADMIN_PASS=25b9b58a38a2
SITES=`yoursite.domain.com`

Edit the ERPNEXT and FRAPPE version numbers to the latest (or desired) versions.

Save and exit

(Ctrl+X, Y, Enter)

4. Edit the docker compose file

Make sure you are still in the /home/yourusername/frappe_docker folder

sudo nano yourproject-compose.yml

The file should look something like this as a start:

name: yourerpnextprojectname
services:
  backend:
    depends_on:
      configurator:
        condition: service_completed_successfully
        required: true
    image: frappe/erpnext:v15.39.3
    networks:
      default: null
    platform: linux/amd64
    pull_policy: always
    volumes:
      - type: volume
        source: sites
        target: /home/frappe/frappe-bench/sites
        volume: {}
  configurator:

From here, you need to replace the version number throughout the file (There are multiple references to this)

An easy way to do this is a find/replace:
- Ctrl +
- In the search bar type in v15.39.3 (Or your current version)
- Enter
- Type in the version you’re wanting to move to e.g. v15.42.0
- Enter
- Press A to change all references
- Save and exit (Ctrl+X, Y, Enter)

5. Pull the new erpnext version

Make sure you are still in the /home/yourusername/frappe_docker folder

Run the following commands:

docker compose -f yourproject-compose.yml pull
docker compose -f yourproject-compose.yml down
docker compose -f yourproject-compose.yml up -d

6. Migrate Sites

I can’t seem to find a reference as to which docker containers this needs to be run on, but the frontend and backend ones seem to have done the trick for me. To check the names of your containers, you can run docker ps

Once you’ve found your front and backend containers, run the following:

docker exec yourbackendcontainer bench --site yoursite.yourdomain.com migrate
docker exec yourfrontendcontainer bench --site yoursite.yourdomain.com migrate

That should be it. I hope this works for you! Please feel free to point out any issues to help others.

References for the above post:

1 Like