The engine "yarn" is incompatible during docker build

I just downloaded latest metabase from repo and tried to docker build for v0.33.0 when i am running “docker build .” then i am getting yarn version Error so would like to know why i am getting this as everything is in dockerfile or either configured images then why i am getting this error and what is the solution of it.

Error:

Step 12/30 : RUN yarn
—> Running in 323e74b888b0
yarn install v1.7.0
$ echo $npm_execpath | grep -q yarn || echo ‘\033[0;33mSorry, npm is not supported. Please use Yarn (https://yarnpkg.com/).\033[0m’
[1/5] Validating package.json…
error metabase@0.0.0: The engine “yarn” is incompatible with this module. Expected version “>=1.12.3”.
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
The command ‘/bin/sh -c yarn’ returned a non-zero code: 1

OS:

CentOS Linux release 7.7.1908 (Core)

Docker Version:

Client: Docker Engine - Community
Version: 19.03.2
API version: 1.40
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:28:55 2019
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.2
API version: 1.40 (minimum version 1.12)
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:27:34 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683

Hi @shailender_singh
Because you’re using a very old version of yarn? Latest stable release is 1.17.3
https://www.metabase.com/docs/latest/developers-guide.html#install-prerequisites
Remember to run ./bin/build before you build the docker, since it uses content (like JAR-file) from the build.

There were multiple issues during ./bin/build but i am managed to fix those but still docker build is failing and used following commands to fix or install all the pre requisite those were mentioned in the list given by you:
Following steps i took to fix this:

rpm -ivh jdk-13_linux-x64_bin.rpm
JAVAC=/usr/bin/javac
set $JAVAC;
export JAVAC

chmod 755 ./bin/build-drivers.sh
chmod 744 verify-driver
chmod 744 verify-doc-links

npm version
node -v
n stable
npm install -g yarn@1.17.3

OR

npm install latest-version -g

yarn version
/tmp/lein.sh install
mv /tmp/lein.sh /bin/lein
mv /tmp/lein.sh /bin/lein
./bin/build no-translations

Final artifact(/bin/build) output:

Created /root/meta-switch/src/metabase/target/uberjar/metabase-core-1.0.0-SNAPSHOT.jar
Created /root/meta-switch/src/metabase/target/uberjar/metabase.jar

Some questions for Dockerfile as internally it supposed to run things as per dockerfile:

a. Why pre compiled artifacts are not present on github as when we supposed to use Dockerfile it is intended that all the pre requisite should be taken care as part of infrastructure as code but if it was not intended then why yarn package installation is not properly configured.

  1. docker build . - > failed output indicates that it is trying to run “yarn install v1.7.0” and i did not found any place where it is mentiond as i tried to add yarn add yarn@v1.17.3 and removed yarn.lock before doing that.

Step 19/37 : RUN yarn

  • —> Running in 26c0687ca27e*
    *yarn install v1.7.0 <----(SEE THIS) *
    $ echo $npm_execpath | grep -q yarn || echo ‘\033[0;33mSorry, npm is not supported. Please use Yarn (https://yarnpkg.com/).\033[0m’
    [1/5] Validating package.json…
    error metabase@0.0.0: The engine “yarn” is incompatible with this module. Expected version “>=v1.12.3”.

c. Last year i did docker build without any issue with v0.30.0 version
d. What is metabase@0.0.0 as even it is as one of the yarn package and even i tried to install yum add metabase@v.1.17.3 but it asks me to choose version i.e. “0.1.0” so what is this ? and do i have to fix metabase yarn version or yarn version itself
Current version:
#npm info yarn
yarn@1.17.3

#yarn -v
1.17.3

Please help how can i build docker image as i assume it is issue with package.json or yarn.lock files

@shailender_singh
I guess your build environment is not up-to-date, since it’s still referencing an old version of yarn. As long as the Metabase repo sees the correct version of it’s dependencies, then global versions shouldn’t matter.
The metabase@0.0.0 is the main package, where you define the dependency packages to. See package.json for more context.
I have setup the build environment multiple times and never changed anything in package.json or yarn.lock or any other file, to make it build.
How are you trying to build Docker, ./bin/docker/build-image.sh ?

  1. downnloaded source from github and “git checkout v0.33.0”
  2. cd metabase
  3. docker build .
    (running docker build directly on source as it has Dockerfile) and same thing i did last time for v0.30.3

My expectation is that it will build local docker image for me so that i can upload it in our local private repos.

I assume i am doing right i did not found much documentation on this front when you have to build docker image from source and i tried to use build-image.sh but it is throwing some errors.
Error:
./build_image.sh source v0.33.0
Building Docker image metabase/metabase-head:v0.33.0 from local source
./…/…/bin/build: line 7: ./bin/version: No such file or directory
Tagging uberjar with version ‘’…
./…/…/bin/build: line 13: resources/version.properties: No such file or directory
./…/…/bin/build: line 14: resources/version.properties: No such file or directory
./…/…/bin/build: line 15: resources/version.properties: No such file or directory
./…/…/bin/build: line 16: resources/version.properties: No such file or directory

I have tried multiple release option v0.33.0,33.0,latest,0.33.0

So as summary i assume we should document more verbose steps for such requirement so would be great if some how you can help me with docker build.

@shailender_singh
This should be enough for building container as long as you have installed all the prerequisites - I would highly recommend that you use 0.33.3 instead of 0.33.0

  1. git clone ...
  2. cd metabase
  3. git checkout v0.33.3
  4. ./bin/build
  5. ./bin/docker/build-image.sh

Thanks @flamber finally it worked for me after following given steps and some extra notes for other users when you are just using metabase code base under your own github repo then you have to provide your own commit version details instead of default metabase checked out version.

./bin/build no-translations

NOTE 1: I was getting gettext package missing error but gettext is installed at OS level and its not clear if its looking for yarn or npm package so more verbose error will be good for other users but after adding no-translations it worked fine.
NOTE 2: i was having my own git package under which i cloned metabase so i build using source and used commit id as release version and 0147a82 is last commit id and after that it worked.

NOTE 3: I assume while uploading to git engeers forgot to change permissions of following files and usually it happens when you push from non linux systems so i changed permissions and after that it succesfully build new docker images
NOTE 4: This time i used v0.33.3 from metabase.zip release instead of 0.33.0

./bin/docker/build_image.sh source 0147a82
cd bin/
chmod 755 build-driver.sh
chmod 755 build-drivers.sh
chmod 755 remove-drivers.sh
chmod 755 test-load-and-dump.sh
chmod 755 verify-doc-links
chmod 755 verify-driver
cd …
./bin/docker/build_image.sh source 0147a82
docker images

My recommendation is to have steps documented for those who would like to build their own docker images as its not well documented and current documentation only talks about how to use docker images from hub. As most of the time opensource users modify some text/images/logo as per their internal requirements and then they rebuild new docker images for their environment. Thanks

@shailender_singh
Great you got it working.
If you don’t clone the project via Github, but only download the source as ZIP, then it will give you the problems you noted.
You’re more than welcome to submit a PR to the documentation, if you think it should be updated.