W
Wasp-lang11mo ago
Nurium

Cant start database docker is not working on wsl properly

✨ Starting a PostgreSQL dev database (based on your Wasp config) ✨ Additional info: ℹ Connection URL, in case you might want to connect with external tools: postgresql://postgresWaspDevUser:postgresWaspDevPass@localhost:5432/nurium_saas-ef32b83560 ℹ Database data is persisted in a docker volume with the following name (useful to know if you will want to delete it at some point): wasp-dev-db-nurium_saas-ef32b83560 ... The command 'docker' could not be found in this WSL 2 distro. We recommend to activate the WSL integration in Docker Desktop settings. For details about using Docker Desktop with WSL 2, visit: https://docs.docker.com/go/wsl2/ wasp-bin: callCommand: docker run --name wasp-dev-db-nurium_saas-ef32b83560 --rm --publish 5432:5432 -v wasp-dev-db-nurium_saas-ef32b83560:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=nurium_saas-ef32b83560 postgres (exit 1): failed nurium_ubuntu@DESKTOP-NUD60OH:~/Projects/nurium_saas$
Docker Documentation
Docker Desktop WSL 2 backend on Windows
Turn on the Docker WSL 2 backend and get to work using best practices, GPU support, and more in this thorough guide.
51 Replies
Nurium
NuriumOP11mo ago
Seems i forgot to save and restart when allowing wsl on the ubuntu via Docker > settings > resources > wsl integration... however now is a new error: " Starting a PostgreSQL dev database (based on your Wasp config) ✨ Additional info: ℹ Connection URL, in case you might want to connect with external tools: postgresql://postgresWaspDevUser:postgresWaspDevPass@localhost:5432/nurium_saas-ef32b83560 ℹ Database data is persisted in a docker volume with the following name (useful to know if you will want to delete it at some point): wasp-dev-db-nurium_saas-ef32b83560 ... docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create?name=wasp-dev-db-nurium_saas-ef32b83560": dial unix /var/run/docker.sock: connect: permission denied. See 'docker run --help'. wasp-bin: callCommand: docker run --name wasp-dev-db-nurium_saas-ef32b83560 --rm --publish 5432:5432 -v wasp-dev-db-nurium_saas-ef32b83560:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=nurium_saas-ef32b83560 postgres (exit 126): failed nurium_ubuntu@DESKTOP-NUD60OH:~/Projects/nurium_saas$ "
martinsos
martinsos11mo ago
@Nurium so this really comes down to your Docker setup, seems like your permissions are not set in a way that Wasp can use them. We do have other people using wasp start db successful from Linux, Mac and also Win with WSL. Have you tried running docker run --help from WSL, as suggested in the error message? Can you run docker commands, do you have permissions? You can also try running the command that Wasp was trying to run (it is there in the error message):
docker run --name wasp-dev-db-nurium_saas-ef32b83560 --rm --publish 5432:5432 -v wasp-dev-db-nurium_saas-ef32b83560:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=nurium_saas-ef32b83560
docker run --name wasp-dev-db-nurium_saas-ef32b83560 --rm --publish 5432:5432 -v wasp-dev-db-nurium_saas-ef32b83560:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=nurium_saas-ef32b83560
and see if that will work for you.
Nurium
NuriumOP11mo ago
seems to have acces, when i wrote "docker run --help" i get: "nurium_ubuntu@DESKTOP-NUD60OH:~/Projects/nurium_saas$ docker run --help Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] Create and run a new container from an image Aliases: docker container run, docker run Options: --add-host list Add a custom host-to-IP mapping etc.. ~~~~~~~~~ ~~~~~~~~~~ i tried copy the whole message, and the first row. That did not work, in the message you provided from the error msg "docker run --name wasp-dev-db-nurium_saas-ef32b83560 --rm --" shows: ""docker run" requires at least 1 argument. See 'docker run --help'. Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] Create and run a new container from an image"
martinsos
martinsos11mo ago
My mistake, I dropped the very last argument, which is postgres, here goes the whole command:
wasp-bin: callCommand: docker run --name wasp-dev-db-nurium_saas-ef32b83560 --rm --publish 5432:5432 -v wasp-dev-db-nurium_saas-ef32b83560:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=nurium_saas-ef32b83560 postgres
wasp-bin: callCommand: docker run --name wasp-dev-db-nurium_saas-ef32b83560 --rm --publish 5432:5432 -v wasp-dev-db-nurium_saas-ef32b83560:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=nurium_saas-ef32b83560 postgres
I am not sure if it will work if you input it as multiline, at least in the form above, so you might want to input it as a single line.
Nurium
NuriumOP11mo ago
shows: "wasp-bin:: command not found"
MEE6
MEE611mo ago
Wohooo @Nurium, you just became a Waspeteer level 1!
martinsos
martinsos11mo ago
ah ok this time I put too much stuff in front, wait here it goes again 😄
docker run --name wasp-dev-db-nurium_saas-ef32b83560 --rm --publish 5432:5432 -v wasp-dev-db-nurium_saas-ef32b83560:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=nurium_saas-ef32b83560 postgres
docker run --name wasp-dev-db-nurium_saas-ef32b83560 --rm --publish 5432:5432 -v wasp-dev-db-nurium_saas-ef32b83560:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=nurium_saas-ef32b83560 postgres
Nurium
NuriumOP11mo ago
"docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create?name=wasp-dev-db-nurium_saas-ef32b83560": dial unix /var/run/docker.sock: connect: permission denied. See 'docker run --help'." ~~~~~~~¨¨¨ Gotta get permission somehow i guess 😛 chatGPT says i can try in docker: "Navigate to the "General" tab and make sure "Expose daemon on tcp://localhost:2375 without TLS" is checked." SHould i try that?
martinsos
martinsos11mo ago
You can try that, but it might not be the solution. It really depends on your setup -> could you shed a bit more light about it? So you are on Windows, and you have WSL -> I guess WSL2, right? How is Docker installed, how did you install it? Which version of Linux is in your WSL? @Boris do you have any ideas maybe on what could be the issue here?
Nurium
NuriumOP11mo ago
docker is just installed on windows i did install hyper-v from a batch file (from youtube..), not sure if that effects anything ~~~~~~~~ ill try that, then it asks me to: "If you're using Docker on Windows and you're encountering permission issues from within the WSL environment, you might need to configure Docker Desktop to work with WSL. Here are the steps to set up Docker Desktop with WSL: Enable WSL Integration in Docker Desktop: Open Docker Desktop settings. Go to the "General" tab. Enable the "Expose daemon on tcp://localhost:2375 without TLS" option. Apply the changes and restart Docker Desktop. Ensure Docker CLI in WSL Uses Windows Docker Daemon: Make sure your WSL environment is set to use the Docker daemon running on Windows. In your WSL terminal, set the DOCKER_HOST environment variable: bash Copy code export DOCKER_HOST=tcp://localhost:2375 You might want to add this line to your shell profile (e.g., ~/.bashrc or ~/.zshrc) to make it persistent across sessions. Restart Docker Daemon on Windows: Restart the Docker Desktop on Windows to apply the changes. After completing these steps, you should be able to run Docker commands from your WSL terminal without encountering permission issues. Try running your Docker command again: bash Copy code docker run --name wasp-dev-db-nurium_saas-ef32b83560 --rm --publish 5432:5432 -v wasp-dev-db-nurium_saas-ef32b83560:/var/lib/postgresql/data --env POSTGRES_PASSWORD=postgresWaspDevPass --env POSTGRES_USER=postgresWaspDevUser --env POSTGRES_DB=nurium_saas-ef32b83560 postgres This setup allows your WSL environment to communicate with the Docker daemon running on Windows. If you encounter any issues or have further questions, feel free to ask."
Boris
Boris11mo ago
via docker desktop or somehow else?
Nurium
NuriumOP11mo ago
i start the Docker Desktop app
Nurium
NuriumOP11mo ago
No description
Boris
Boris11mo ago
go to settings > general and check this if it is selected
No description
martinsos
martinsos11mo ago
I don't have experience with Hyper-V, so that makes it hard for me to give a concrete answer here. What is the relation of Hyper-V and WSL? I would suggest you search for "docker permissions Hyper-V" or "docker permissions WSL", I expect some usual problems and their solutions will pop out!
Nurium
NuriumOP11mo ago
No description
Nurium
NuriumOP11mo ago
ok thx ill check that, and maybe try the solution GPT gave. 🙂 (Windows home can only run the WSL 2 backend)..?
Boris
Boris11mo ago
Windows Home might be the issue here
Nurium
NuriumOP11mo ago
Hyper-V wasnt installed on Home therefore i found a batchfile on youtube that worked i got it installed
Boris
Boris11mo ago
can you check if hyper-v is running? try opening powershell/terminal in an admin mode
Nurium
NuriumOP11mo ago
ok
MEE6
MEE611mo ago
Wohooo @Nurium, you just became a Waspeteer level 2!
Boris
Boris11mo ago
and type this Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V
Nurium
NuriumOP11mo ago
Get-WindowsOptionalFeature: command not found
Boris
Boris11mo ago
this should be the result
No description
Nurium
NuriumOP11mo ago
so hyper-v is not installed properly or set up properly
Boris
Boris11mo ago
I am 99% sure it is issue with Windows Home, as you need Pro version to have it properly running
Nurium
NuriumOP11mo ago
that may be the easiest solution i guess 😛 can you upgrade without removing stuff? formating
Boris
Boris11mo ago
According to Microsoft, you should be able to https://support.microsoft.com/en-us/windows/upgrade-windows-home-to-windows-pro-ef34d520-e73f-3198-c525-d1a218cc2818 but I can't really say as I've always used the Pro version
Upgrade Windows Home to Windows Pro - Microsoft Support
Learn how to upgrade from Windows 10 Home to Windows 10 Pro or Windows 11 Home to Windows 11 Pro, including how to use a valid product key or the Microsoft Store.
Nurium
NuriumOP11mo ago
ok thx 🙂
martinsos
martinsos11mo ago
Tnx @Boris !
Nurium
NuriumOP11mo ago
@Boris Excuse me, it do work when i write it in Powershell*, i thought i had to write it in the wsl mode.. Its not working in wsl, should it?
Nurium
NuriumOP11mo ago
No description
Boris
Boris11mo ago
it should work in powershell, but not in WSL mode, so that's ok. On a glance, everything should be Ok. Can you go to "Turn Windows features on or off" and check if Hyper-V is enabled there?
No description
Nurium
NuriumOP11mo ago
i have already enabled that 🙂
Nurium
NuriumOP11mo ago
So it seem to work. I restarted the Docker and VSCode studio program and then i could start the database with wasp start db. Dont know what i did. I did enable ipTSL in Docker, not sure if its that. Maybe i try to disable that and see if it still works. Anyway, 🙂 Glad it works. Thx for help!
No description
Nurium
NuriumOP11mo ago
Not sure if its stuck, ben loading here for few minuets now.
No description
Nurium
NuriumOP11mo ago
hmm i only got 100mb space
Nurium
NuriumOP11mo ago
not sure how to remove it or if i need to..? It still stuck at compiling wasp project
No description
Boris
Boris11mo ago
From what it looks like, it seems like you have it already running according to that message.
Nurium
NuriumOP11mo ago
docker didnt work properly it seems. Tried to delete the docker db instance. Now after sleeping and restarting stuff i all seemed to work.
MEE6
MEE611mo ago
Wohooo @Nurium, you just became a Waspeteer level 3!
Boris
Boris11mo ago
Great to hear that!
Joshua
Joshua9mo ago
sudo apt update && sudo apt install docker.io -y worked for me for anyone else who goes through this 🙂 I hit the exact same issue
Vinny (@Wasp)
Vinny (@Wasp)9mo ago
Awesome. Do you think this would be helpful to add to the OpenSaaS docs for Linux users?
martinsos
martinsos9mo ago
So basically reinstalling docker? Were you also on WSL? If we are adding this info somewhere, we should probably add it to Wasp docs, not open saas?
Boris
Boris9mo ago
I agree, if added, it should be added to the Wasp doc section. Although, installing Docker Desktop for Windows + WSL2 does install Docker inside Ubuntu by default, so it is not a necessary step in the process.
Vinny (@Wasp)
Vinny (@Wasp)9mo ago
hmm. okay. maybe it's too much of an edge case?
Boris
Boris9mo ago
IMO, yes, and it is not really Wasp-related, but to the use of Ubuntu/WSL/Docker
Joshua
Joshua9mo ago
Yes, I was on WSL, I'm going to re-do the installation process on my desktop and see if I run into the same situation. It had docker already installed, but for whatever reason the bug above persisted (even adjusting settings, resetting cpu, etc.) What did work is re-installing docker. These (this and similar) threads are helpful to navigate through!
martinsos
martinsos9mo ago
Interesting, maybe default installation of Docker is problematic, and reinstalling it like this helps? Awesome, I am glad it helps!
Want results from more Discord servers?
Add your server