Trying to install wasp within a docker image, and it always fail
I am trying to install wasp within a docker image (to subsequently build the client app).
But
wasp version
command keeps failing.
Here is my dockerfile for reference. Can someone help me spot my mistake
29 Replies
Hi @abhinav3295. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The issue might be related to the Node.js version you are using in your Dockerfile. In the knowledge sources, it is mentioned that Wasp is currently specifying Node 14 in their Dockerfile and they have upgraded it to Node 16 (source (https://github.com/wasp-lang/wasp/issues/667)). However, in your Dockerfile, you are using Node 22.6.0-slim. This could potentially be the cause of the issue.
Here is the updated Dockerfile with Node 16:
Please note that the
apk
package manager is used instead of apt-get
because the base image is now Alpine Linux. If you still encounter issues, it might be helpful to check the installation logs or any error messages that appear during the build process.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @abhinav3295, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?What you are referring to is older documentation, in the latest version its recommended to use node version higher than 18
and the code samples in the installation guide uses node v.20
Yep, Kapa made a mistake here. Let me see what's up. 😄
Here's what worked for me:
I had to add
--platform=linux/amd64
because I'm building it on Mac M2.Thanks @miho
can you please also tell me how can I enable debugging for the wasp server content?
I am trying to connect (vscode) debugger to server using the processed
*processId
On server logs I see that the debugger is connected, but none of the breakpoints work
Any suggestions (I am fairly new to nodejs)
I think this thread will get you what you need 🙂 https://ptb.discord.com/channels/686873244791210014/1134423535310360667/1134477751303295086
Hey,
I am also trying to run that on my M3.
Tried your dockerfile until the
COPY
part, but i am getting the following error:
Any idea? 🙂The output doesn't look like you are building the Docker image, how are you running this?
I built a docker image until
COPY
, then i started a container with that image and did the rest manually (for testing)
@miho ping 🙂Wohooo @DaniO, you just became a Waspeteer level 1!
Can you provide me with code and command so I can do the same thing as you did? I want to be able to reproduce the issue on my machine so I can help better 🙂
@miho
I have the following Dockerfile:
Then I ran
docker build -t wasp .
and docker run --rm -it wasp bash
Inside the container i executed:
Which results into the following error:
If I can provide more info just ping me please 🙂
---
Edit:
This seems to only be a problem with my Macbook.
I started a redhat VM and executed the same commands, there it worked 😄
I built it once with linux/amd64
and once with linux/arm64
.
With ARM I am getting:
Gotcha! Thanks for the instructions, I'll try it tomorrow on my Mac 👍
Doing the same steps works on my machine 🫠
I ran it like this
docker run --rm -p 3000:3000 -p 3001:3001 -it wasp bash
to expose the ports.
I got this error since Vite can't open the browser automatically:
but that's okay.
I think the trick is in the choice of the Node image:
Try not using the slim variant maybe?Thanks a lot!
But argh - tried it with bookworm, bullseye and alpine - still failing.
For some strange reason it fails later, if I rerun it. The logfile is the output from
node:22.6.0-bullseye
Any other idea? 😬@martinsos how could we debug the
waspc
next? I'm not sure what to suggest.
TLDR: running wasp start
in a Docker container results in 310 Segmentation fault
@miho i don't get why it is working for you, but not for me.
Do i maybe have some setting set wrong?
I'm using MacOS 14 with M2 Pro chip with OrbStack https://orbstack.dev/ (this is just a nicer Docker Desktop, but it might influence the result) and I did the same thing as you did 🤷♂️
Why do you want to run Wasp in a Docker container? Can you maybe install Wasp directly on your machine?
OrbStack
OrbStack · Fast, light, simple Docker & Linux on macOS
Say goodbye to slow, clunky containers and VMs. The fast, light, and easy way to run containers and Linux. Develop at lightspeed with our Docker Desktop alternative.
It's a company notebook and I don't wanna pollute it to much 😄
I will start a cloud server and do it with remote development, if we can't find a solution here 🙂
Also tried it now with the raspberry PI - direct install, without docker. Same result 😄
It will likely have to do with some deps missing on the machine it is running on -> either unexpected architecture, or missing/wrong deps (like glibc). Although I wouldnt' neccessarily expect it to manifest as segmentation fault (although it might).
The thing is, the Linux binary for Wasp is built on Ubuntu. Which doesn't guarantee it will work on other Linux distributions, although it often does.
We will likely want to produce static binary in the future, so it doesn't depends on stuff like glibc, but we are not doing it yet.
Or we could produce binaries for different popular dists.
What you can do right now @DaniO is try to run it in a docker that is based on Ubuntu, and see if that helps.
If not, then it has to be connect to you running this from mac with M3 hm.
@miho as for how to get more info from waspc -> here are a couple of general solutions:
1. Run
wasp
with gdb
and then backtrace
2. Add +RTS -xc
, like wasp +RTS -xc
, it might show more info. (ok this solution is haskell specific)
3. Try gdb wasp core
in case there is a core dump generated on the machine.@martinsos I tried it with the ubuntu baseimage and had the same result.
@DaniO thanks for persisting!
Since we had no other complaints so far + @miho wasn't able to replicate it on hiw M2 mac, and you also got it working on RedHat, we concluded this is connected to your Mac, and most likely the fact it uses M3.
@miho do we have anybody in the team with M3, so that we can try to reproduce this?
And just to be clear, what is the simplest way to try to reproduce this: on M3, trying to run Wasp inside simple Dockerfile.
Btw @DaniO , I think I never asked -> did you manage toget Wasp wokring directly on your machine, without Dockerfile? Just
wasp start
?@martinsos No problem, happy to help.
As I already mentioned, I can work around this by using a ubuntu vm.
Yes
wasp start
is working, without any problems.I would bet that there shouldn't be differences between M2 and M3 macs in this regard. Also, probably we have other users with M3 macs since they are not new new and people got macs with them. I'm not sure where to point my finger next 🤷♂️
OK yeah and it does work direclty on M3! Wow that is unusal then indeed.
Maybe it is my mac setup, but i can't remember setting anything different. i also tried to build it with different platforms (amd/arm).
Also had the same issue trying it with a raspberry pi 4 (OS:
Debian GNU/Linux 12 (bookworm)
) and tried to run wasp there directly.
Wohooo @DaniO, you just became a Waspeteer level 2!
Ok hm. Keep in mind taht we build wasp binaries on Ubuntu (x86_64) and on Mac. Github Actions is here: https://github.com/wasp-lang/wasp/blob/main/.github/workflows/waspc-ci.yaml. So if Raspberry pi uses arm64, taht might be the resason, we probably download the linux binary but it is built for x86_64
Ok actually just found this GH issue of ours, it mentions taht Wasp doesn't work on Raspbian due to this: https://github.com/wasp-lang/wasp/issues/2003
GitHub
Investigate building Wasp for more Linux architectures (i.e. ARM) ·...
Currently (as of 0.13.2), we're releasing Wasp Linux builds only for Ubuntu x86. It works on most of the Linux distribution, but not all of them (e.g., Raspbian). For users that don't run a...
@abhinav3295 maybe I will say something silly now, but what if you ran this Dockerfile on your M3 via Rosetta? Woudl that make sense? I don't have much expreince with Mac so let me know if this makes no sense
Ah yes but it works directly on M3, keep forgetting that, ok than probably that won't help hm.