Docker image build fails

Hello,

I’m trying to build a docker image off a brand new installation, and it fails miserably. Here’s what I’ve done (I think I followed the instructions from the tutorial properly, but since I’m new to this…):

  • Installed tutor with pip install "tutor[full]"
  • Cloned the repository into my own edx-platform local folder
  • Checked-out the open-release/quince.1 tag, which is the one I want to work from
  • Mounted the local folder into tutor with tutor mounts add .\edx-platform
  • Started the image creation with tutor images build openedx-dev

It apparently fails with unresolved references. The log is below (I’ve removed most of the messages to make this post reasonably sized…).

Any idea ? Thanks.

 => ERROR [production 26/30] RUN openedx-assets xmodule     && openedx-assets npm     && openedx-assets webpack  174.6s
------
 > importing cache manifest from openedx-dev:17.0.1-cache:
------
------
 > [production 26/30] RUN openedx-assets xmodule     && openedx-assets npm     && openedx-assets webpack --env=prod     && openedx-assets common:
1.179 WARNING:root:xmodule/static_content.py, aka xmodule_assets, is now a no-op. Please remove calls to it from your build pipeline. It will soon be deleted.
1.506 scripts/copy-node-modules.sh
1.530 =====================================================================================
1.530 Copying required assets from node_modules...
1.530 -------------------------------------------------------------------------------
1.530 Ensuring vendor directories exist...
1.530 +mkdir -p common/static/common/js/vendor
1.544 +mkdir -p common/static/common/css/vendor
1.549 Copying studio-frontend JS & CSS from node_modules into vendor directores...
1.564 +cp --force node_modules/@edx/studio-frontend/dist/common.min.js.map common/static/common/js/vendor
1.615 +cp --force node_modules/@edx/studio-frontend/dist/assets.min.js common/static/common/js/vendor

[...]

1.713 +cp --force node_modules/backbone.paginator/lib/backbone.paginator.js node_modules/backbone/backbone.js node_modules/bootstrap/dist/js/bootstrap.bundle.js node_modules/hls.js/dist/hls.js node_modules/jquery-migrate/dist/jquery-migrate.js node_modules/jquery.scrollto/jquery.scrollTo.js node_modules/jquery/dist/jquery.js node_modules/moment-timezone/builds/moment-timezone-with-data.js node_modules/moment/min/moment-with-locales.js node_modules/picturefill/dist/picturefill.js node_modules/requirejs/require.js node_modules/underscore.string/dist/underscore.string.js node_modules/underscore/underscore.js node_modules/which-country/index.js common/static/common/js/vendor
1.812 Copying certain JS developer modules into vendor directory...
1.812 +cp --force node_modules/sinon/pkg/sinon.js common/static/common/js/vendor
1.889 +cp --force node_modules/squirejs/src/Squire.js common/static/common/js/vendor
1.892 -------------------------------------------------------------------------------
1.892  Done copying required assets from node_modules.
1.892 =====================================================================================
3.531   0% compiling  0% 10% building modules 0/1 modules 1 active ...ommon_static/js/ven  5% [0] building modules 0/1 m  5% 10% building modules 1/2 modules 1 a  5% [0] building modules 1/2 modules 1 active ...dule.js ./xmodule/js/src/html  5% 10% building modules 2/3 modules 1 a  5% [0] building modules 2/3 modules 1 active ...er.js ./xmodule/js/src/collap  5% 10% building modules 3/4 modules 1 a  5% [0] building modules 3/4 modules 1 active ...e.js ./xmodule/js/src/raw/edi  5% 10% building modules 4/5 modules 1 a  5% [0] building modules 4/5 modules 1 active ...er.js

[...]

174.5     [./cms/static/js/factories/xblock_validation.js] ./cms/static/js/factories/xblock_validation.js 744 bytes {16} [built]
174.5         + 1462 hidden modules
174.5
174.5     ERROR in Entry module not found: Error: Can't resolve './lms/static/support/jsx/single_support_form.jsx' in '/openedx/edx-platform'
174.5
174.5     ERROR in multi ./xmodule/js/src/xmodule.js ./xmodule/js/src/html/display.js ./xmodule/js/src/javascript_loader.js ./xmodule/js/src/collapsible.js ./xmodule/js/src/html/imageModal.js ./xmodule/js/common_static/js/vendor/draggabilly.js
174.5     Module not found: Error: Can't resolve './xmodule/js/common_static/js/vendor/draggabilly.js' in '/openedx/edx-platform'
174.5      @ multi ./xmodule/js/src/xmodule.js ./xmodule/js/src/html/display.js ./xmodule/js/src/javascript_loader.js ./xmodule/js/src/collapsible.js ./xmodule/js/src/html/imageModal.js ./xmodule/js/common_static/js/vendor/draggabilly.js

[...]

174.5     ERROR in ./cms/static/js/views/license.js
174.5     Module not found: Error: Can't resolve 'templates/license-selector.underscore' in '/openedx/edx-platform/cms/static/js/views'
174.5      @ ./cms/static/js/views/license.js 1:0-147:2
174.5      @ ./cms/static/js/views/metadata.js
174.5      @ ./cms/static/js/views/xblock_editor.js
174.5      @ ./cms/static/js/views/modals/edit_xblock.js
174.5      @ ./cms/static/js/views/pages/container.js
174.5      @ ./cms/static/js/factories/container.js
 70% 69% building modules 1471/1472 modul 69% [0] building modules 1471/1472 modules 1 active ...us-lock/dist/es2015/uti 69% [0] building modules 1471/1475 modules 4 69% building modules 1471/1472 modules 1 active ...us-lock/dist/es2015/uti 70% 69% building modules 1476/1477 modul 69% [0] building modules 1476/1477 modules 1 active ...s-lock/dist/es2015/util[0] Traceback (most recent call last):
174.6   File "/openedx/bin/openedx-assets", line 218, in <module>
174.6     main()
174.6   File "/openedx/bin/openedx-assets", line 89, in main
174.6     args.func(args)
174.6   File "/openedx/bin/openedx-assets", line 124, in run_webpack
174.6     subprocess.check_call(
174.6   File "/opt/pyenv/versions/3.8.18/lib/python3.8/subprocess.py", line 364, in check_call
174.6     raise CalledProcessError(retcode, cmd)
174.6 subprocess.CalledProcessError: Command '['webpack', '--progress', '--config=webpack.prod.config.js']' returned non-zero exit status 2.
------
Dockerfile:212
--------------------
 211 |     # is modified.
 212 | >>> RUN openedx-assets xmodule \
 213 | >>>     && openedx-assets npm \
 214 | >>>     && openedx-assets webpack --env=prod \
 215 | >>>     && openedx-assets common
 216 |     COPY --chown=app:app ./themes/ /openedx/themes/
--------------------
ERROR: failed to solve: process "/bin/sh -c openedx-assets xmodule     && openedx-assets npm     && openedx-assets webpack --env=prod     && openedx-assets common" did not complete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/default/default/ijtyz1szt8dr3rd40ditaeam2
Error: Command failed with status 1: docker buildx build --tag=openedx-dev:17.0.1 --output=type=docker --target=development --build-arg=APP_USER_ID=1000 --cache-from=type=registry,ref=openedx-dev:17.0.1-cache --build-context=edx-platform=D:\Pyt\DevRepository\Mainbot\edx-platform C:\Users\pytho\AppData\Local\tutor\tutor\env\build\openedx

Hi Pyt,

Welcome to the community.

Can you check the command of mount ? tutor mounts add ./edx-platform it’s forward slash instead of backwards, although depending on OS it could differ.

Second, instead of building openedx-dev, can you first try to build openedx image ? like tutor images build openedx

If that build works you can build openedx-dev, but if that fails too, you can post here with more details.

Also are there any themes that you’ve added or any other customisations that you’ve done in your edx-platform or themes .js files?

Hello Chintan,

Thanks for your reply. The “\” comes from the fact that I’m running on Windows. The mount succeeds and tutor mounts list gives appropriate results:

- name: D:\(removed for confidentiality purpose)\edx-platform
  build_mounts:
  - image: openedx
    context: edx-platform
  - image: openedx-dev
    context: edx-platform
  compose_mounts:
  - service: openedx
    container_path: /openedx/edx-platform

I’ve tried tutor images build openedx and it gives the same results. I operate off an exact clone of the repository, and I have checked out the open-release/quince.1 tag, to which have made no modification whatsoever.
I have the full session transcript with all messages logged to screen, but I didn’t find any way to attach a text file to this post.

try any of the following:

  • tutor images build openedx --no-cache
  • tutor images build openedx --no-registry-cache
  • tutor images build openedx --no-cache --no-registry-cache

In some cases I’ve been able to force the image to build using those flags.

I tried all 3, and got the same results.

Steps to reproduce

  1. pip install “tutor[full]”
  2. pip install “tutor-indigo”
  3. tutor dev launch
  4. wait for it to fail :slight_smile:

Glad I’m not alone (sort of… :smiling_face_with_tear:)
I confirm it fails whatever the combination of the --no-cache and --no-registry-cache options…

Same thing when trying to just use the command that is running by hand.

docker buildx build --tag=openedx-dev:17.0.2 --output=type=docker --target=development --build-arg=APP_USER_ID=2035178926 --cache-from=type=registry,ref=openedx-dev:17.0.2-cache '/Users/user/Library/Application Support/tutor/env/build/openedx'
 > [development 4/4] RUN rm -r /openedx/staticfiles &&     mkdir /openedx/staticfiles &&     openedx-assets webpack --env=dev:
1.083   0% compiling  0% 10% building modules 0/ 1 19% 19% building  23% 23% building mod  3 6 67% [0] building modules 537/556 modules 19 active ...kBrowser/data/actions/courseBlocks.js[BABEL] Note: The code generator has deoptimised the styling of /openedx/edx-platform/common/static/js/vendor/tinymce/js/tinymce/tinymce.js as it exceeds the max of 500KB.
 8 90% 91% additi 92% [0] chunk asset optimizationTraceback (most recent call last):
92.61   File "/openedx/bin/openedx-assets", line 218, in <module>
92.61     main()
92.61   File "/openedx/bin/openedx-assets", line 89, in main
92.61     args.func(args)
92.61   File "/openedx/bin/openedx-assets", line 124, in run_webpack
92.61     subprocess.check_call(
92.61   File "/opt/pyenv/versions/3.8.18/lib/python3.8/subprocess.py", line 364, in check_call
92.61     raise CalledProcessError(retcode, cmd)
92.61 subprocess.CalledProcessError: Command '['webpack', '--progress', '--config=webpack.dev.config.js']' died with <Signals.SIGKILL: 9>.
------
Dockerfile:266
--------------------
 265 |     # static assets, then production assets will be served instead.
 266 | >>> RUN rm -r /openedx/staticfiles && \
 267 | >>>     mkdir /openedx/staticfiles && \
 268 | >>>     openedx-assets webpack --env=dev
 269 |
--------------------
ERROR: failed to solve: process "/bin/sh -c rm -r /openedx/staticfiles &&     mkdir /openedx/staticfiles &&     openedx-assets webpack --env=dev" did not complete successfully: exit code: 1

@misilot are you also on windows machine as @Pyt

I am using ubuntu and I did a fresh build after install and mount and it worked

I am on a m1 Mac.

Hi @misilot, this error occurs when the resources you have assigned to docker are depleted and it kills the processes for compiling the SASS files. This issue has already been mentioned here.

For this reason, you can try to increase resources that are available to Docker. You can also try to close any existing applications or stop any running containers that might be consuming high amounts of memory. If this still does not resolve your issue, you can try to limit the resources used by docker by following the troubleshooting docs mentioned here.