Error Restore locally hosted ERPNext 14 to a new v15 Docker Container

Hello,

I did a backup from a working production setup of version-14 ERPnext.

This setup is on a local host.

Then created a new docker container for a version-15 ERPNext with the Apps: HRMS, CRM, Gameplan, Insights, Print_designer, Builder and others.

I logged into the docker setup and ran the setup wizard and finished successfully.

Then when I try to restore the back into the container using the command:

bench restore --force --with-public-files 20240410_014010-erp_our_site-files.tar.gz --with-private-files 20240410_014010-erp_our_site-private-files.tar.gz 20240410_014010-erp_our_site-database.sql

I get the follow error:

b'/usr/bin/bash: line 1: file: command not found\n'
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 134, in restore
    _restore(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 166, in _restore
    err, out = frappe.utils.execute_in_shell(f"file {sql_file_path}", check_exit_code=True)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/__init__.py", line 484, in execute_in_shell
    raise Exception("Command failed")
Exception: Command failed

Will appreciate the help on this

Khaldoun

You forgot b it’s a bench not ench

Hi

A quick Google of the error came up with this:

https://askubuntu.com/questions/881514/bash-file-command-not-found

maybe the same?

Also, the bench restore command often wants a --site [sitename] argument.

Thank you @smino … You are right. I was diving into solving the issue from a Frappe/ERPNext perspective, while it was actually a Docker Image issue.

Not sure why few packages are not included! Will rebuild the image and confirm here once this is solved.

Thank you… a copy-paste issue. Fixed now!

Hello,

@smino Yes, you are right.Adding the file, less and gpg packages to the image and building again worked fine.

At the time of bench restore the gzip/gunzip were also needed as files backup files are in TAR.GZ format.

So, to get restore working, either the gzip/gunzip are needed when building the docker image or simply have the files backup copied to the container as TAR files (this worked for me).

So, thanks a lot for pointing out the solution to this.

Have a great day.