jupyenv
jupyenv copied to clipboard
building a docker image on mac (with linux builder) results in wrong executable
Hi there, I am trying to use jupyterWith
to build a docker image on a Mac (OSX 10.15.7) using linuxkit and once it completes and the image is loaded, I get
standard_init_linux.go:228: exec user process caused: exec format error
Building other images with linuxkit works fine, i.e. I can replace jupyterWith
and install python packages directly and I get a usable docker image.
This is the derivation I'm trying:
with import <nixpkgs> { system = "x86_64-linux"; };
let
jupyter = import (builtins.fetchGit {
url = https://github.com/tweag/jupyterWith;
rev = "";
}) {};
jupyterEnvironment = jupyter.jupyterlabWith {};
in
pkgs.dockerTools.buildLayeredImage {
name = "jupyter";
tag = "latest";
created = "now";
contents = [ jupyterEnvironment ];
config = {
Env = [
"LOCALE_ARCHIVE=${pkgs.glibcLocales}/lib/locale/locale-archive"
"LANG=en_US.UTF-8"
"LANGUAGE=en_US:en"
"LC_ALL=en_US.UTF-8"
];
CMD = [ "/bin/jupyter-lab" "--ip=0.0.0.0" "--no-browser" "--allow-root" ];
WorkingDir = "/data";
ExposedPorts = {
"8888" = {};
};
Volumes = {
"/data" = {};
};
};
}
(I copy pasted the mkDockerImage
from jupyterWith
because if I use it directly it complains about a null string - should probably open another issue for that)
nix show-derivation
gives
{
"/nix/store/mkcspsnzayiv8792az134l4j7pq0yvgj-jupyter.tar.gz.drv": {
"outputs": {
"out": {
"path": "/nix/store/44sj3gi87bck57hfw81jx1g6qrspz6cs-jupyter.tar.gz"
}
},
"inputSrcs": [
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
"inputDrvs": {
"/nix/store/2dy7nk5akq9xyiwbc4mc3plw1hllf7k7-pigz-2.6.drv": [
"out"
],
"/nix/store/935zsps49kjnh4fj6g6pzh1g169kdxkb-stdenv-linux.drv": [
"out"
],
"/nix/store/i1bb0rw1dqrkji0101c9ri9mmfaai0jq-bash-4.4-p23.drv": [
"out"
],
"/nix/store/wc2lr988mp5vmma0jbvkpgn41hvgyjhh-stream-jupyter.drv": [
"out"
]
},
"platform": "x86_64-linux",
"builder": "/nix/store/dpjnjrqbgbm8a5wvi1hya01vd8wyvsq4-bash-4.4-p23/bin/bash",
"args": [
"-e",
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
"env": {
"buildCommand": "/nix/store/xb9v340rhxbmdv565sb4z89r696s9nx9-stream-jupyter | pigz -nT > $out",
"buildInputs": "",
"builder": "/nix/store/dpjnjrqbgbm8a5wvi1hya01vd8wyvsq4-bash-4.4-p23/bin/bash",
"configureFlags": "",
"depsBuildBuild": "",
"depsBuildBuildPropagated": "",
"depsBuildTarget": "",
"depsBuildTargetPropagated": "",
"depsHostHost": "",
"depsHostHostPropagated": "",
"depsTargetTarget": "",
"depsTargetTargetPropagated": "",
"doCheck": "",
"doInstallCheck": "",
"imageName": "jupyter",
"name": "jupyter.tar.gz",
"nativeBuildInputs": "/nix/store/14g69x4xyp27mngb8zfp5mwiw203dl6k-pigz-2.6",
"out": "/nix/store/44sj3gi87bck57hfw81jx1g6qrspz6cs-jupyter.tar.gz",
"outputs": "out",
"passAsFile": "buildCommand",
"patches": "",
"propagatedBuildInputs": "",
"propagatedNativeBuildInputs": "",
"stdenv": "/nix/store/28ba35p0qv3lrjgpxd6dz4kfjfryr55l-stdenv-linux",
"strictDeps": "",
"system": "x86_64-linux"
}
}
}
Would be grateful for any pointers you might have!
I think the problem is that system
needs to be set on jupyterWith
import - I've tried it like this:
let
pkgs = import <nixpkgs> { system = "x86_64-linux"; };
jupyter = import (builtins.fetchGit {
url = https://github.com/tweag/jupyterWith;
rev = "";
}) { inherit pkgs };
but this results in jupyter_contrib_base
not being found, since the packages provided by jupyterWith
are overriden. How can I set the system to be x86_64-linux
?
This is not really the issue for jupyterWith but a general Nix issue.