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.
Related
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.
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.
I'm using Windows 7 Pro and have existing shared Docker engine running on a Linux. I would like to use my workstation (with development environment) to access shared Docker engine.
Does someone know how to retrieve Docker client only for Windows 7 ? I have no admin privilege, so I can't install Docker Toolbox.
Older Clients can be found here https://download.docker.com/win/static/stable/x86_64/
And here a some newer Builds by Stefan Scherer (Docker employee) https://github.com/StefanScherer/docker-cli-builder.
Just download docker.exe and add it to your windows path variable.
Then set your DOCKER_HOST variable to define against which Docker daemon you want to speak.
The official Downloads have finally been published:
Mac CLI binaries are available at
https://download.docker.com/mac/static/stable/
Windows CLI (and daemon) binaries at https://download.docker.com/win/
Linux CLI packages are available for each distro as docker-cli (deb and rpm) packages: https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/
From: https://github.com/docker/cli/issues/2281#issuecomment-947699400
Although docker provides a REST-like API, there aren't many clients for it. A quick google turned up one on github, but ymmv. Even if you did find one, you're likely to run into the same problems involved in running docker-ce locally anyway.
There are a handful of gui clients that you could run on that engine and access with a browser, but if you are specifically after a cli you're SOL with this.
If you have an ssh client (git bash, or putty, or something), and you can arrange to run a bastion container on the engine, then you could run a container to ssh into and use that as if it's your local machine. You'd still have to scp resources onto it, but you'll eventually have to solve that problem anyway. Something like:
sudo docker container run --interactive --tty -v /var/run/docker.sock:/var/run/docker.sock image
Where 'image' is a linux image with an ssh server and appropriate keys, git, and docker installed. You could mount a local volume for persistence, or you could just keep everything in git.
I want to work on an aws machine for a kaggle competition. While working on my own pc i have Anaconda installed, pycharm.
How do i set it up on an AWS machine?
Do i need to install the tools each time i log in the AWS machine.
What is the recommended way for this cases?
I thought of running a jupyter notebook instance on the remote machine, and connect to that web page via my local machine.
What are the pitfalls to be expected?
You need to launch an EC2 instance in AWS and connect it through SSH to run your algorithms. The following link can help you further.
http://www.grant-mckinnon.com/?p=6
In these cases using Docker images helps the best in encapsulating the environment. Kaggle also uses docker to create environments for kernels. You can install Docker from here. You can pull the docker image using following command,
docker pull datmo/kaggle:python
After this, you can run containers using this image and mount necessary files in order to run the same environment.
docker run --rm -it -p 8888:8888 -v ~/.:/home/ datmo/kaggle:python 'jupyter notebook'
You can also use datmo CLI in order to easily setup environment and also version control your machine learning models.
I am trying to figure out development with django and postgresql while using windows as the host OS. I followed 2 tutorials and both of them want me to run commands using docker-compose run, but it doesn't work on windows. It says:
> docker-compose.exe run web django-admin.py startproject rolesweb .
←[31mERROR←[0m: Interactive mode is not yet supported on Windows.
Please pass the -d flag when using `docker-compose run`.
Is there an alternative to this command? What should I do to be able to follow the tutorials further?
The tutorials:
https://docs.docker.com/compose/django/
https://realpython.com/blog/python/django-development-with-docker-compose-and-machine/
An alternative is to run docker-compose through a container where docker-compose is installed. That is what I initially recommended. In that context, the -d option would be supported.
docker-compose itself depends on nodejs/node-gyp which does not work well on Windows.