简体   繁体   中英

Why sail didn't build my laravel container?

I followed the guide in laravel document.Run the command composer require laravel/sail --dev and command php artisan sail:install in my terimal.After that I tried the command ./vendor/bin/sail up , but I got this: No such file or directory .I turn to termial and open an Ubuntu tab to run this command.But I got this

Building laravel.test
[+] Building 27.0s (4/4) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 38B                                                                                0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => ERROR [internal] load metadata for docker.io/library/ubuntu:21.04                                             26.9s
 => [auth] library/ubuntu:pull token for registry-1.docker.io                                                      0.0s
------
 > [internal] load metadata for docker.io/library/ubuntu:21.04:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize: rpc error: code = Unknown desc = failed to fetch oauth token: Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fubuntu%3Apull&service=registry.docker.io": net/http: TLS handshake timeout
ERROR: Service 'laravel.test' failed to build : Build failed

I tried docker login...failed. I tried delete the vendor directory and then run command composer update to update my sail file... failed.

Please help me.Great thanks!

I encountered similar problems when I was setting up laravel sail project and here is my solution.

If you get No such file or directory , please confirm that you have Laravel Sail installed successfully and the files are there under vendor/bin/sail

Then, you should check that the DNS is configured correctly. Try ping google.com and see if there's any response. If not, it is probably why you're encountering this problem and there's some work for you. However, we just need to configure the DNS and it is pretty simple.

  1. Create a file sudo vim /etc/wsl.conf
  2. Add the following line
[network]
generateResolvConf=false
  1. Save and exit :wq
  2. sudo vim /etc/resolv.conf Your file may probably look like this
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.28.32.1
  1. Just replace the nameserver to 8.8.8.8
nameserver 8.8.8.8
  1. Finally go to your project directory and try ./vendor/bin/sail up again

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM