Meteor docker image build failed with server pointing to localhost

Sorry, I am new to Docker Image.

When I follow the docker meteord instructions here https://hub.docker.com/r/abernix/meteord/ and try to build my docker image locally using private NPM token with this build command:

docker build --build-arg NPM_TOKEN=“mytoken” -t myorg/myapp:latest .

It throws this error:

/opt/meteord/lib/build_app.sh: line 21: 456 Killed meteor build --allow-superuser --directory $BUNDLE_DIR --server=http://localhost:3000
The command ‘/bin/sh -c bash $METEORD_DIR/lib/build_app.sh’ returned a non-zero code: 137

Docker image: abernix/meteord:node-8.11.3-onbuild

Wondering why docker build would point its server to localhost? I can’t understand why the build would fail with this command.

Any help will be greatly appreciated.

Thanks,

@abernix any help appreciated

I suspect the process is running out of memory by the kernel since it’s Killed in such an abrupt manner. Unfortunately, there’s not much to work with there. If you’re building a large application, could you try something smaller, like a basic meteor create --minimal minimal-app-example app?

Thanks.

I tried running myself, I get the following…

Step 1/7 : FROM abernix/meteord:node-8.11.3-onbuild
node-8.11.3-onbuild: Pulling from abernix/meteord
5dfbbcdbbb10: Pull complete 
a3ed95caeb02: Pull complete 
a6bea34b8b42: Pull complete 
57d207cbab3b: Pull complete 
5a9318745727: Pull complete 
162036907a92: Pull complete 
b5b7628a520d: Pull complete 
b3b98a317beb: Pull complete 
Digest: sha256:c1da2f8633f871b700fcc8b715081a2061e9cb249bf576a76a7c1ce460022990
Status: Downloaded newer image for abernix/meteord:node-8.11.3-onbuild
# Executing 4 build triggers
 ---> Running in b3ac092020b0
Removing intermediate container b3ac092020b0
 ---> Running in 26fb5e9676b4
Downloading Meteor distribution
tar: .meteor/packages/http/.1.4.1.61lwj7.g4axu++os+web.browser+web.cordova/npm/node_modules/.bin: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/modules/node_modules/.bin: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/modules/node_modules: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/modules: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules/regjsparser/node_modules/.bin: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules/regjsparser/node_modules: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules/regjsparser: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules/.bin: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler/node_modules: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor/babel-compiler: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules/meteor: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm/node_modules: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os/npm: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova/plugin.compile-ecmascript.os: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript/.0.11.1.1y6vme2.nump++os+web.browser+web.browser.legacy+web.cordova: Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript: Directory renamed before its status could be extracted
tar: .meteor/packages/ddp-server/.2.2.0.p95w5l.e5qx++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/.bin: Directory renamed before its status could be extracted
tar: .meteor/packages/ddp-server/.2.2.0.p95w5l.e5qx++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules: Directory renamed before its status could be extracted
tar: .meteor/packages/ddp-server/.2.2.0.p95w5l.e5qx++os+web.browser+web.browser.legacy+web.cordova/npm: Directory renamed before its status could be extracted
tar: .meteor/packages/ddp-server/.2.2.0.p95w5l.e5qx++os+web.browser+web.browser.legacy+web.cordova: Directory renamed before its status could be extracted
tar: .meteor/packages/ddp-server: Directory renamed before its status could be extracted
tar: .meteor/packages/babel-compiler/.7.1.1.m3476k.4x6m++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/regjsparser/node_modules/.bin: Directory renamed before its status could be extracted
tar: .meteor/packages/babel-compiler/.7.1.1.m3476k.4x6m++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/regjsparser/node_modules: Directory renamed before its status could be extracted
tar: .meteor/packages/babel-compiler/.7.1.1.m3476k.4x6m++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/regjsparser: Directory renamed before its status could be extracted
tar: .meteor/packages/babel-compiler/.7.1.1.m3476k.4x6m++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/.bin: Directory renamed before its status could be extracted
tar: .meteor/packages/babel-compiler/.7.1.1.m3476k.4x6m++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules: Directory renamed before its status could be extracted
tar: .meteor/packages/babel-compiler/.7.1.1.m3476k.4x6m++os+web.browser+web.browser.legacy+web.cordova/npm: Directory renamed before its status could be extracted
tar: .meteor/packages/babel-compiler/.7.1.1.m3476k.4x6m++os+web.browser+web.browser.legacy+web.cordova: Directory renamed before its status could be extracted
tar: .meteor/packages/babel-compiler: Directory renamed before its status could be extracted
tar: Exiting with failure status due to previous errors
The command '/bin/sh -c bash $METEORD_DIR/lib/install_meteor.sh' returned a non-zero code: 2

For my last error … seems like https://github.com/pommi/cflinuxfs2/commit/ef9b052bc908f6abd3aedc97f14ce92edc0a831f
https://github.com/docker/hub-feedback/issues/727

@abernix Thanks for the quick reply.

We tried to remove some of the third party packages in our project and ran but no luck.

We found there were some reference errors in those third party packages json file. We fixed them and tried to run the docker build command again but it throws the permission error as:

=> Executing Meteor Build...
declare -x HOME="/root"
declare -x HOSTNAME="99737403540d"
declare -x METEORD_DIR="/opt/meteord"
declare -x NODE_VERSION="8.11.3"
declare -x OLDPWD="/"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
declare -x PWD="/copied-app"
declare -x SHLVL="1"

Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app
directory will be incorrect if you ever attempt to perform any Meteor tasks as
a normal user. If you need to fix your permissions, run the following command
from the root of your project:

  sudo chown -Rh <username> .meteor/local


Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app
directory will be incorrect if you ever attempt to perform any Meteor tasks as
a normal user. If you need to fix your permissions, run the following command
from the root of your project:

  sudo chown -Rh <username> .meteor/local

/opt/meteord/lib/build_app.sh: line 21:   456 Killed                  meteor build --allow-superuser --directory $BUNDLE_DIR --server=http://localhost:3000
The command '/bin/sh -c bash $METEORD_DIR/lib/build_app.sh' returned a non-zero code: 137

Then I followed the instructions and did

sudo chown -Rh myusername .meteor/local

and ran the build command again, it throws the same error as above.

Any ideas, please?

@abernix FYI re my issue above with tar inside the Docker image

Directory renamed before its status could be extracted
tar: .meteor/packages/ecmascript: Directory renamed before its status could be extracted

I resolved it as per https://github.com/meteor/meteor/issues/5762#issuecomment-327854093 by including the Docker Desktop settings on my mac

{
"storage-driver": "aufs"
} 

but as per https://github.com/meteor/meteor/issues/5762#issuecomment-413378238 its short lived… not sure if you have any other ideas for the long term, please?

@abernix also still stuck with the rather unhelpful error

/opt/meteord/lib/build_app.sh: line 21:   488 Killed                  meteor build --allow-superuser --directory $BUNDLE_DIR --server=http://localhost:3000
The command '/bin/sh -c bash $METEORD_DIR/lib/build_app.sh' returned a non-zero code: 137

I removed the minifiers incase this was causing issues. I am also geting the same issue as @diwei77chen Even with METEOR_ALLOW_SUPERUSER ...

An help appreciated… I need to get a docker image update to a customer and this is blocking me… so up for any ideas to try and rectify.

@abernixactually it was memory… I increased it on my desktop from 2GB to 7GB inside the Docker desktop and it builds - YAY!

@diwei77chen FYI

OMG. This took me so much time and energy to figure out. Thanks for sharing!

The build step now takes 32 minutes! But at least it doesn’t run out of memory any more.

Solution:

ENV TOOL_NODE_FLAGS "--max-old-space-size=4096 --optimize_for_size --gc-interval=100"

in combination with:

image