Docker is not running when trying to curl laravel - laravel

I am trying to set up Docker and Laravel 9 (both for the first time) on my Windows 10 system by following the instructions on the official Laravel website.
I have successfully installed Docker Doesktop and have also successfully installed and activated Windows Subsystem for Linux 2 (WSL2).
I then installed Windows Terminal, connect to an Ubuntu 22.04 container that I have started and tried to run the following command as instructed on the official Laravel website:
curl -s https://laravel.build/example-app | bash
But instead of creating a new project example-app, I get the following message instead:
Docker is not running.
What am I doing wrong?

Ok so I finally figured it out. When I open Windows Terminal, I need to first run wsl and then go forward with curl-ing Laravel and using it.
So after installing and activating WSL2 in Windows & Docker Desktop, the steps to follow would be:
In your terminal, run wsl.
Run the curl -s https://laravel.build/example-app | bash command.
cd to the the new Laravel application example-app directory and then use Laravel Sail to run it.

Related

Cant Install Laravel with Docker on Windows WSL

I can't seem to install the new laravel with Docker Desktop on Windows 10.
What I did so far:
I installed Docker Setup with WSL2.
then I installed Ubuntu Distro from Ms Store.
then on command prompt terminal I run wsl command then when I tried to run curl -s "https://laravel.build/example-app" | bash I got this error -sh: curl: not found.
I can't event use the apt command, it gives the same error.
The only working command is ls
WSL integration options on Docker Desktop are already checked
Am I missing something here? How to fix this?
It looks like the curl command is not installed in your Ubuntu WSL distribution. You can install it by running the following command in your WSL terminal:
sudo apt-get update
sudo apt-get install curl
This should install curl and allow you to run the curl command to download the Laravel installer script.
If you're still having trouble using apt, it's possible that your Ubuntu WSL distribution is not properly installed or configured. You may want to try reinstalling or resetting it.
Once you have curl installed, try running the Laravel installer script again with the curl command:
curl -s "https://laravel.build/example-app" | bash
This should create a new Laravel application in a directory called example-app.
If you're still having trouble, you can try using the Docker image for Laravel instead of installing it directly on your machine. The official Laravel Docker image includes everything you need to get started with Laravel in a containerized environment.

Installing Laravel in Docker Container

Environment: Windows 11 + Docker Desktop 4.12.0
I've been digging this the entire morning. There doesn't seem to be a way of installing Laravel in a Docker image. You must curl it in your WSL2 distro. Trying the command curl -s https://laravel.build/example-app | bash in a Docker container command-line immediately returns the dreaded Docker is not running error message
Some suggest that I need to turn on my "WSL2 integration" checkbox in Docker Desktop settings, but that didn't help.
So what if I download the official Ubuntu image from Docker Hub, run it as a container. Can I download (curl) Laravel in that container?
And while we are here, how does the Bitnami Laravel image differ from the standard procedure given in Laravel documentation? I like it because I can download it as a normal Docker image and create as many containers as I want, but I'm unsure how this connects or contrasts with the official Laravel method.
If it helps anyone, the curl -s https://laravel.build/example-app | bash command downloads several Docker images including MariaDB, Redis, mailhog etc. and therefore needs Docker to be running on the host machine (which is not available inside a container, that's why you can't run the curl command there). Once downloaded, it creates a new container containing (no puns intended) one container for each of these images. You can also customize the list of images/containers that your Laravel application needs by passing the list of services in the curl command like this: curl -s https://laravel.build/example-app?with=mysql,redis. Thanks #apokryfos for the helpful comment. Once these containers are running, you can use VSCode (together with GIT) to connect to them and do your development work.
Of course, you can still use the old-school method of Laravel development. Just install XAMPP or one of its cousins on your machine and then use composer create-project command from the terminal to create it on your local file system. Then host your database and website on locally running instances of Apache and MariaDB.
I have yet to check out Bitnami Laravel image and how it works.

How can run Docker in linux 20.04 in Windows 11

Hi, I have this problem, trying to running Docker in Ubuntu 20.04 in windows 11 using the WSL, I installed it using the official documentation in https://docs.docker.com/engine/install/linux-postinstall/, I tried with some commands like:
sudo service docker start | restart
Show me OK but this didn't work when I tried to execute again the run hello-world command.
Can you help me please?
You should install Docker for Windows and manage it from there, rather than a service within WSL. Then in the preferences, you can link it to WSL2, where it'll install the Docker CLI.

Docker is not running when run curl command to create new laravel project

I just start learning laravel, and follow the tutorial from https://laravel.com/docs/8.x/installation "Getting started on Windows" .
I manage to install Docker Desktop and COnfigured to use WSL2 Backend.
When I run the command curl -s https://laravel.build/example-app | bash to create laravel application directory from cmd, this warning come out Docker is not running.
I run curl using command prompt. (cmd).
Update:
So, I run the command in Windows Terminal:.
PS E:\Play> curl -s https://laravel.build/example-app | bash
Here is the response I get:
cmdlet Invoke-WebRequest at command pipeline position 1
Supply values for the following parameters:
Uri:
Any Idea what to do?
Try to explicitly enable integration with your distro in Docker settings:
After that relaunch your WSL2 terminal & try again. That should help.
You can also open https://laravel.build/example-app in a browser & check what commands the script is running: and run them manually to check the output for any errors.
For those who are using Ubuntu or Debian can check this guide out on how to install and configure Docker.
sudo snap install docker
sudo usermod -aG docker $(whoami)
sudo chmod 666 /var/run/docker.sock
You need to install a linux distro, and then in Windows Terminal create a new tab for the linux distro and run the command there, not in a windows powershell tab.
Make sure that you are running curl command on your distro. Use Windows Terminal app and open a new tab as WSL2 (your distro).
sudo chmod 666 /var/run/docker.sock
I guess you are using ubuntu or debian.
chmod will do the trick here.

docker-compose command not available for mac

I installed docker with the instructions here, downloading from docker-hub
https://docs.docker.com/docker-for-mac/install/
But when I run docker-compose I get this error
pyenv: docker-compose: command not found
The `docker-compose' command exists in these Python versions:
3.6.5/envs/myenv
Also, docker-compose is available under /Users
which docker-compose
/Users/<username>/.pyenv/shims/docker-compose
In this link says, docker-compose for mac need not be installed explicitly as it is part of docker for desktop mac.
https://docs.docker.com/compose/install/
Is something wrong with my installation?
I ran into the same issue on macOS today. Turned out that you need to run the installed app once, it does some additional downloading and setup. That setup includes setting up your path variables.
docker-compose is a utility that is now a parameter in mac docker
so instead of docker-compose up, its now docker compose up
if you install docker from official website then docker-compose will come along with that for mac so need to either upgrade and documentation is present there.

Resources