I’ve been searching for a couple of hours already, can’t still find the solution, feeling very frustrated.
I’ve installed make tool with chocolatey and docker, and am trying to build linuxkit tool
https://github.com/linuxkit/linuxkit
and then using it build linux VM image for Docker
From the README:
"LinuxKit uses the linuxkit tool for building, pushing and running VM images.
Simple build instructions: use make to build. This will build the tool in bin/."
I run make install
but again and again, whatever I do it keeps failing
PS C:UsersTimDesktoplinuxkit-masterlinuxkit-master> make install
cp -R bin/* /usr/local/bin
process_begin: CreateProcess(NULL, cp -R bin/* /usr/local/bin, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:78: install] Error 2
In Makefile: 77,78:
install:
cp -R bin/* $(PREFIX)/bin
I’ve tried changing makefile because there is no such path as usr/local/bin on Windows, but whatever I change it to, the build never succeeds.
I’ve even tried running it on wsl:
root@DESKTOP-GF982I3:/mnt/c/users# cd /mnt/c/Users/Tim/Desktop/linuxkit-master/linuxkit-master
root@DESKTOP-GF982I3:/mnt/c/Users/Tim/Desktop/linuxkit-master/linuxkit-master# make install
cp -R bin/* /usr/local/bin
cp: cannot stat 'bin/*': No such file or directory
make: *** [Makefile:78: install] Error 1
root@DESKTOP-GF982I3:/mnt/c/Users/Tim/Desktop/linuxkit-master/linuxkit-master#
But yet again the error is on the 78th line.
Please, help.
EDIT:
I’ve encountered an error on linux as well
With docker engine installed and daemon running:
tim@tim-vm:~/Desktop/linuxkit/linuxkit-1.0.1$ sudo make
make -C ./src/cmd/linuxkit
make[1]: Entering directory '/home/tim/Desktop/linuxkit/linuxkit-1.0.1/src/cmd/linuxkit'
fatal: not a git repository (or any of the parent directories): .git
tar cf - -C . . | docker run --rm --net=none --log-driver=none -i -e GOARCH= linuxkit/go-compile:7b1f5a37d2a93cd4a9aa2a87db264d8145944006 --package github.com/linuxkit/linuxkit/src/cmd/linuxkit --ldflags "-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.GitCommit= -X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version="v0.8+"" -o linuxkit > tmp_linuxkit_bin.tar
gofmt...
vendor/github.com/Code-Hex/vz/v3/internal/objc/finalizer_118.go:8:18: expected '(', found '['
vendor/github.com/moby/buildkit/frontend/attest/sbom.go:75:13: expected '(', found '['
vendor/github.com/moby/buildkit/frontend/frontend.go:15:28: expected ';', found '['
vendor/github.com/moby/buildkit/frontend/gateway/client/client.go:17:28: expected ';', found '['
vendor/github.com/moby/buildkit/solver/result/result.go:16:15: expected ']', found any
vendor/github.com/moby/buildkit/solver/result/result.go:26:2: expected declaration, found 'if'
vendor/github.com/moby/buildkit/solver/result/result.go:68:3: expected declaration, found 'return'
vendor/github.com/moby/buildkit/solver/result/result.go:91:2: expected declaration, found 'if'
govet...
golint...
./cache/write.go:357:1: exported method Provider.ImageInCache should have comment or be unexported
sh: exported: unknown operand
make[1]: *** [Makefile:40: tmp_linuxkit_bin.tar] Error 2
make[1]: *** Deleting file 'tmp_linuxkit_bin.tar'
make[1]: Leaving directory '/home/tim/Desktop/linuxkit/linuxkit-1.0.1/src/cmd/linuxkit'
make: *** [Makefile:61: linuxkit] Error 2
While tweaking makefile file on windows I have encountered a similar problem.
As you can see, the script creates a .tar file but instantly deletes it.
I will re-iterate that main goal is to run linux Docker containers on Windows, and as I’ve read LinuxKit would build specific .iso images for using with Hyper-V that would provide more efficiency such as a faster startup and less CPU and memory overhead compared to a regular Hyper-V machine.
But since I’m having trouble with linuxkit I will have to resort to using regular Hyper-V machine.
2
Answers
You are feeling frustrated because you’re trying to use a project that was created to work on GNU/Linux, on a Windows system. That simply will not work. Windows and Linux are completely different in just about every way imaginable and it takes an enormous amount of effort for a project to be able to work on both of them. Most projects don’t have the time, energy, or interest to do that.
This error:
is because you’re trying to run the Linux program
cp
, on Windows. And that program doesn’t exist on Windows.Then you switched to WSL. I don’t know much about WSL, but you’re moving in the right direction: WSL provides a Linux-like environment that you can run (some) Linux-style programs in.
This error:
now is running Linux
cp
, but it’s saying that it’s trying to copy the files in thebin
directory and there are no such files. I can’t explain why exactly but just to be clear: theinstall
target in a Makefile usually will install files that you already built. In your example text above, you didn’t run amake
command that actually builds anything (usually that’s justmake
with no targets).So, maybe you can’t run
make install
because there is nothing to install, because you didn’t build the code yet.It seems to me that a project like linuxkit (just going from the name and description, I know nothing about it) which is used to build Linux distributions, will almost certainly NOT be something you can run on Windows. Possibly not even in WSL. You should check with the project to see what their requirements are.
You may need to go back to the drawing board here: either get a separate system and install GNU/Linux on it, or create a real virtual machine (not just WSL) and run this there, or find another tool that is designed to run on Windows.
The second error that you have encountered on Linux is because the go-compiler container image used in the build is old, and apparently no longer compatible with the actual code. The linuxkit/go-compile:7b1f5a37d2a93cd4a9aa2a87db264d8145944006 container uses go 1.16.3. You can update the Makefiles to use a newer version, just get an appropriate one from here: https://hub.docker.com/r/linuxkit/go-compile/tags — At least at the moment of this writing, linuxkit/go-compile:c97703655e8510b7257ffc57f25e40337b0f0813 (which provides go 1.19.4) seems to work well.