Closed mattfletcher closed 4 years ago
Most likely something went wrong when building the image. I just ran the commands locally, and it went through without any errors.
Can you try running this command and see if any errors come before Unable to find image
?
php artisan served:up php
I am getting the same errors on a newly installed Laravel project after running php artisan served:run
.
It seems the images arent beeing pulled and so they arent beeing build.
@K2ouMais be aware that you need to run php artisan served:up
on the first run. This will build and run the images. Using run alone will not build them first.
The images are built on disk to allow customizing them through the config/served.php
file (if published)
@sinnbeck
It still doesnt work for me, but I think it is because I am behind a proxy and so most things dont work well.
Could you put some keys in the config for a Proxy?
'proxy' => [
'http_proxy' => env('SERVED_HTTP_PROXY', ''),
'https_proxy' => env('SERVED_HTTPS_PROXY', ''),
],
// Now build the containers with this command
// This is just an Example
docker-compose build --build-arg http_proxy=config('served.proxy.http_proxy') --build-arg https_proxy=config('served.proxy.https_proxy')
Only use the --build-arg
if the var is not empty.
Thanks
@K2ouMais Actually I am not using docker-compose. Only native docker commands. First I use docker build
to create images and then docker run
to run each of them. I might look into how using a proxy works with that. Edit: It seems that you can actually set it for your user. https://docs.docker.com/network/proxy/#configure-the-docker-client
Can you also try running php artisan served:up php
and see if there is some error while building the image? It comes before the "Stating php.." part. The text is most likely red :)
Oh and you can see the actual commands being run by adding -v
to a command
Example
$ php artisan served:up php -v
docker version --format="{{json .Client.Version}}"
docker info
docker port served_served_web 80
docker port served_served_web 443
docker port served_served_mysql 3306
Creating network: served
docker network inspect 'served'
Building php (Php 7.4-fpm) ...
docker build -t 'served/served_php' --build-arg uid='1000' . -f '/var/www/served/storage/app/served/php/Dockerfile'
That last one is the build command.
@sinnbeck
I have the proxy set in Docker Desktop.
But for some reason I still have to use the --build-arg
while building a container on completely other projects, even when it is set on Docker Desktop.
I just wanted to use your package, to be a bit easier for me and the other devs on my team. The most of them dont use Docker a lot. For some reasons I cant use your package here on our company and I could bet it is mainly because of the proxy.
I tried everything, even just running a single container with php artisan served:run php -v
and that gives me exactly the same error.
At the end it says it is SERVED, but as you can see there are no images and no container running.
Just to show you that I can pull images:
Can you try composer update
and then php artisan served:up
again. I just found a bug after the release of composer 2, that might be causing some issue.
I might try getting it to stop on failure, to make it easier to debug :)
Hi, I still get the same errors.
Just tried on my PC at home where there isnt a proxy set and I get the same errors aswell.
I really dont know how to help you out on this.
Just released v0.6.6 which stops on error and shows the error on screen. Hope that can help :)
Sorry, but seems that I cant get it to work.
Can you show the first line as well, where you run the command?
There you go. I tried all containers and then just the php container.
@K2ouMais You are still using served:run
instead of served:up
? To get it to build the newest image, you need to use up
:)
You are right... I messed up.
Now I have another problem and this is really because of the proxy.
Here is an example of a working Dockerfile, that is working for us:
RUN pear config-set http_proxy my.proxy.de:3128 \
&& apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS \
&& apk add --update git libtool protobuf autoconf g++ make zlib-dev linux-headers automake postgresql-dev
Without that pear config line it doesnt work for us.
That's alright. No worries
Does it by any chance work if you run it like this? (replace the HOSTNAME
with the actual proxy host) :)
docker build -t 'served/laradocker_php' --env HTTPS_PROXY="https://HOSTNAME:3128" --build-arg uid='1000' . -f 'c:\laragon\www\laradocker\storage\app\served\php\Dockerfile'
You can also try adding the proxy directly in the Dockerfile
Open c:\laragon\www\laradocker\storage\app\served\php\Dockerfile
and add these two lines just after FROM library/php:7.4-fpm
ENV http_proxy http://yourhost:3128
ENV https_proxy https://yourhost:3128
And then run
docker build -t 'served/laradocker_php' --build-arg uid='1000' . -f 'c:\laragon\www\laradocker\storage\app\served\php\Dockerfile'
If one of these work, I will implement it today.
Seems the command is missing something.
@K2ouMais It might be sligtly different on windows (I am on ubuntu). I tried to guess the command on windows, but might have missed it a bit. I dont use windows normally.
Try running php artisan served:up php -v
and stop it instantly (ctrl+c?) to see the command for running it (be aware that this will reset your Dockerfile)
It could just be without quotes
docker build -t served/laradocker_php --build-arg uid=1000 . -f c:\laragon\www\laradocker\storage\app\served\php\Dockerfile
@sinnbeck
Seems the command on Windows is:
docker build -t "served/laradocker_php" --build-arg uid=1000 . -f "C:\laragon\www\laradocker\storage\app/served/php/Dockerfile"
It seems to work with the ENV options in the Dockerfile.
It doesnt work on the command itself because there is no --env option.
And this is another error:
@K2ouMais Awesome. I am just adding that do the Dockerfile. I assume people dont want their proxy settings saved in the Dockerfile, but passed down through the build command instead?
I will try to find a workaround for getting the keyserver to handle proxy as well..
You can try replacing this line
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
With
gpg --batch --keyserver ha.pool.sks-keyservers.net --keyserver-options http-proxy=http://YOURHOST:3128 --recv-keys "$key"; \
@sinnbeck I dont see a problem with having the proxy in the Dockerfiles.
Normaly that are only people behing their companys Proxy and the projects are inhouse or private.
Like I said earlier, it didnt work as an env option on the command, because there isnt any env option for docker build
.
You could take the proxy from the command docker info
. The HTTP and HTTPS proxys are there.
If you have set the proxy on the Docker Desktop app you can see it there.
I am still having the same problem with "gpg". It seems to ignore the proxy.
@K2ouMais Great. I will just add it to the Dockerfile. Easy fix. I am trying to find a way to get that keyserver in some other way, but no luck so far. Perhaps I will remove it if a proxy is set for now. All it does is install mysqldump, enabling you to use the new schema:dump
command. If anyone has any idea of how to get it to work behind a proxy, I will happily accept a PR :)
Man I am impressed how you are handling all this.
I am just simple person, that really wants to use this package with a team of 15 people.
The new schema:dump
command is really cool, but I dont know how many people are really using it.
Maybe they are using it on projects that are running for a few years and have a lot of migrations.
Thank you for all this... If you want me to test something let me know.
There is a small chance that in December we wont need a proxy anymore. The proxy have beeing a pain in the a** for some time now.
It's my first package so it means alot for me that it works well. And before I give it v1.0, I want all of the bugs out. So I am just happy to have found one of them, so I can get it fixed.
I should have a version out tomorrow that works with proxy.
Just curious, what is your set up? Windows 10 + wsl2? That was my setup for testing it out on windows, but docker was reaaaalty slow until I moved the project to a wsl share with Ubuntu.
https://twitter.com/rsinnbeck/status/1312465445585264641?s=19
My setup at work is Windows, Laragon (like XAMP but easier) and WSL1. The company I am working for is still on an older Windows 10 build and so I am still waiting for WSL2 to beeing rollout. Developing in WSL1 is a pain and so I try to stick to Windows only or Docker.
All the tests today was done in Windows 10 with the Cmder Terminal and Docker Desktop.
I use for 80% of my projects Docker, but I was searching for an easier way to integrate this in my team, because not everyone knows Docker well and so your package is more than welcome to help the most there.
Can you try
composer update
and thenphp artisan served:up
again.
Yep, it works now. Thanks for the fix. Nice package!
I just tried this package for the first time and I'm getting:
The web and mysql seem to have started just fine.
Steps were as follows: