skip to Main Content

I’m having issues getting Laravel Sail to work on new laravel 8 project, I’m on Ubuntu 20.04 LTS , i followed the instructions as explained on Laravel Sails Documentation

What i did so far was :

First i created a new Laravel Project :

composer create-project --prefer-dist laravel/laravel blog

Then installed sails :

composer require laravel/sail --dev

Published sails’s docker-compose.yml :

php artisan sail:install

Finally started sails :

./vendor/bin/sail up 

But i’m getting this error :

ERROR: Service 'laravel.test' failed to build

This is the complete error message :

Pulling mysql (mysql/mysql-server:8.0)...
8.0: Pulling from mysql/mysql-server
639d1bdfca05: Pull complete
9e100c7b198d: Pull complete
427d2cdb963c: Pull complete
4436dc023066: Pull complete
5800f7888dd1: Pull complete
798cd8b6d3ec: Pull complete
c5ce8d5cf40e: Pull complete
Digest: sha256:91170bd4e012f0bf46b5141a38b612427b37692e8465cdffe9b0ca2d74d37d8a
Status: Downloaded newer image for mysql/mysql-server:8.0
Building laravel.test
Step 1/18 : FROM ubuntu:21.04
21.04: Pulling from library/ubuntu
9e6a0d5477cf: Pull complete
Digest: sha256:93a94c12448f393522f44d8a1b34936b7f76890adea34b80b87a245524d1d574
Status: Downloaded newer image for ubuntu:21.04
 ---> d662230a2592
Step 2/18 : LABEL maintainer="Taylor Otwell"
 ---> Running in 89940512e780
Removing intermediate container 89940512e780
 ---> 2b6050bc73a0
Step 3/18 : ARG WWWGROUP
 ---> Running in c33ba5cd161c
Removing intermediate container c33ba5cd161c
 ---> cd665779f65a
Step 4/18 : ARG NODE_VERSION=16
 ---> Running in 1fab74b70fc7
Removing intermediate container 1fab74b70fc7
 ---> 9fc2b36920f3
Step 5/18 : WORKDIR /var/www/html
 ---> Running in 53a071a9db21
Removing intermediate container 53a071a9db21
 ---> cd9c5c32babc
Step 6/18 : ENV DEBIAN_FRONTEND noninteractive
 ---> Running in a9e045bff55e
Removing intermediate container a9e045bff55e
 ---> 0cc113458364
Step 7/18 : ENV TZ=UTC
 ---> Running in 9827c7d2f5e1
Removing intermediate container 9827c7d2f5e1
 ---> 0f209195f47a
Step 8/18 : RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 ---> Running in ccafa5e32e94
Removing intermediate container ccafa5e32e94
 ---> b58053a83ede
Step 9/18 : RUN apt-get update     && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2     && mkdir -p ~/.gnupg     && chmod 600 ~/.gnupg     && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf     && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C     && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C     && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu hirsute main" > /etc/apt/sources.list.d/ppa_ondrej_php.list     && apt-get update     && apt-get install -y php8.1-cli php8.1-dev        php8.1-pgsql php8.1-sqlite3 php8.1-gd        php8.1-curl        php8.1-imap php8.1-mysql php8.1-mbstring        php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap        php8.1-intl php8.1-readline        php8.1-ldap        php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole        php8.1-memcached php8.1-pcov php8.1-xdebug     && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer     && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -     && apt-get install -y nodejs     && npm install -g npm     && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -     && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list     && apt-get update     && apt-get install -y yarn     && apt-get install -y mysql-client     && apt-get install -y postgresql-client     && apt-get -y autoremove     && apt-get clean     && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ---> Running in 279bb38a60ad
Err:1 http://archive.ubuntu.com/ubuntu hirsute InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu hirsute-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hirsute/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hirsute-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hirsute-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/hirsute-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
Package ca-certificates is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package gnupg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'gnupg' has no installation candidate
E: Unable to locate package gosu
E: Unable to locate package curl
E: Package 'ca-certificates' has no installation candidate
E: Unable to locate package zip
E: Unable to locate package unzip
E: Unable to locate package git
E: Unable to locate package supervisor
E: Unable to locate package sqlite3
E: Unable to locate package libcap2-bin
E: Unable to locate package libpng-dev
E: Unable to locate package python2
ERROR: Service 'laravel.test' failed to build: The command '/bin/sh -c apt-get update     && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2     && mkdir -p ~/.gnupg     && chmod 600 ~/.gnupg     && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf     && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C     && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C     && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu hirsute main" > /etc/apt/sources.list.d/ppa_ondrej_php.list     && apt-get update     && apt-get install -y php8.1-cli php8.1-dev        php8.1-pgsql php8.1-sqlite3 php8.1-gd        php8.1-curl        php8.1-imap php8.1-mysql php8.1-mbstring        php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap        php8.1-intl php8.1-readline        php8.1-ldap        php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole        php8.1-memcached php8.1-pcov php8.1-xdebug     && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer     && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -     && apt-get install -y nodejs     && npm install -g npm     && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -     && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list     && apt-get update     && apt-get install -y yarn     && apt-get install -y mysql-client     && apt-get install -y postgresql-client     && apt-get -y autoremove     && apt-get clean     && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*' returned a non-zero code: 100

Any idea on why i’m getting this error, and how i can solve it ?

2

Answers


  1. Chosen as BEST ANSWER

    Basically this error means there is no connectivity between the container and the internet but i wasn't able to figure out why this happened.

    Thanks to Rwd who did mention this Github Issue in the comment section i noticed that am using an old version of docker, i was running Ubuntu 16.04 .. later i upgraded to 20.04, during the upgrade the docker repository was disabled so i ended up not upgrading docker for quiet a time.

    So what i did was simply reinstalling docker :

    I removed the old versions

    sudo apt-get remove docker docker-engine docker.io containerd runc
    

    Update the apt package index and install packages to allow apt to use a repository over HTTPS:

    sudo apt  update
    
     sudo apt  install 
        ca-certificates 
        curl 
        gnupg 
        lsb-release
    

    Add Docker’s official GPG key:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    

    Set up the stable repository:

    echo 
      "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu 
      $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    

    Finally :

     sudo apt update
    
     sudo apt install docker-ce docker-ce-cli containerd.io
    

    Since i already have done the Post-installation steps before i simply skipped it, after restarting docker, the error was gone , sail up ran successfully


  2. I had not installed Docker and php artisan sail:install was not installed, go through the steps again and the problem will be solved

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search