Home > PHP Framework > Laravel > Let's talk about Mac Laravel docker sail building issues

Let's talk about Mac Laravel docker sail building issues

藏色散人
Release: 2021-11-16 14:47:00
forward
2686 people have browsed it

Write a monologue first

I haven’t written code in PHP for more than two years, and now I’m picking it up again. I used to use TP, but the version update of TP is very unfriendly. , so this time I use Laravel in one step. Let’s start with the docker environment first. I will try and write as I go. Everyone is welcome to interact with me and teach me more. I also hope my newbie experience can help some people.

[Recommended: laravel tutorial]

1. Docker Desktop installation

Detailed tutorial in the forum

2. Run the container (encountered a "pit"!)

I followed the tutorial step by step, but my operation did not go smoothly until the sixth step. The following occurred Situation

ERROR: Service 'laravel.test' failed to build : Build failed
Copy after login

I looked at the log carefully and the error appeared in

#9 7.166 Some packages could not be installed. This may mean that you have
#9 7.166 requested an impossible situation or if you are using the unstable
#9 7.166 distribution that some required packages have not yet been created
#9 7.166 or been moved out of Incoming.#9 7.166 The following information may help to resolve the situation:#9 7.166#9 7.166 The following packages have unmet dependencies:#9 7.262  gnupg : Depends: gpgv (< 2.2.19-3ubuntu2.1.1~) but 2.2.20-1ubuntu3 is to be installed
#9 7.264  perl : Depends: perl-base (= 5.30.0-9ubuntu0.2) but 5.32.1-3ubuntu2.1 is to be installed
#9 7.264         Recommends: netbase but it is not going to be installed
#9 7.264  perl-base : Breaks: perl (< 5.32.1~) but 5.30.0-9ubuntu0.2 is to be installed
#9 7.265  zlib1g-dev : Depends: zlib1g (= 1:1.2.11.dfsg-2ubuntu1.2) but 1:1.2.11.dfsg-2ubuntu6 is to be installed
#9 7.265               Depends: libc6-dev but it is not going to be installed or
#9 7.265                        libc-dev
#9 7.283 E: Unable to correct problems, you have held broken packages.
Copy after login

There are many dependencies that seem to be problematic

#9 7.262  gnupg : Depends: gpgv (< 2.2.19-3ubuntu2.1.1~) but 2.2.20-1ubuntu3 is to be installed
Copy after login

It should be that a higher version has been installed, so I tried replacing apt-get with aptitude. Unlike apt-get, aptitude is better at handling dependency issues. For example, when aptitude deletes a package, it will also delete the packages it depends on. In this way, useless packages will not remain in the system, and the entire system will be cleaner.

So I adjusted the Dockerfile

RUN apt-get update \    && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \
Copy after login

and changed it to

RUN apt-get update \    && apt-get install -y aptitude \    && aptitude install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \
Copy after login

Run again
./vendor/bin/sail up
The situation has become different, but the error is still reported

#9 32.31 E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
Copy after login

The installation was not successful, but it was just executed.
Tried againapt-get install -fBut still no effect

Okay, I changed my mind and looked at it. Since the higher version mentioned has been installed, I will do it based on the higher ubuntu, so I modified FROM, from

FROM ubuntu:21.04
Copy after login

changed to

FROM ubuntu:latest
Copy after login

Okay, a new dependency problem is coming

#9 44.96 Some packages could not be installed. This may mean that you have
#9 44.96 requested an impossible situation or if you are using the unstable
#9 44.96 distribution that some required packages have not yet been created
#9 44.96 or been moved out of Incoming.#9 44.96 The following information may help to resolve the situation:#9 44.96#9 44.96 The following packages have unmet dependencies:#9 45.08  php8.0-bcmath : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08  php8.0-cli : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08               Depends: php8.0-opcache but it is not going to be installed
#9 45.08               Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 45.08               Depends: libxml2 (>= 2.8.0) but it is not going to be installed
#9 45.08  php8.0-curl : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08  php8.0-dev : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08               Recommends: pkg-php-tools but it is not going to be installed
#9 45.08  php8.0-gd : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08  php8.0-igbinary : Depends: php8.0-common but it is not going to be installed
#9 45.08  php8.0-imap : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08  php8.0-intl : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08                Depends: libicu67 (>= 67.1-1~) but it is not installable
#9 45.08  php8.0-ldap : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08  php8.0-mbstring : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08  php8.0-memcached : Depends: php8.0-common but it is not going to be installed
#9 45.08  php8.0-msgpack : Depends: php8.0-common but it is not going to be installed
#9 45.08  php8.0-mysql : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08  php8.0-pcov : Depends: php8.0-common but it is not going to be installed
#9 45.08                Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 45.08  php8.0-pgsql : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08  php8.0-readline : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08  php8.0-redis : Depends: php8.0-common but it is not going to be installed
#9 45.08  php8.0-soap : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08                Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 45.08                Depends: libxml2 (>= 2.7.4) but it is not going to be installed
#9 45.08  php8.0-sqlite3 : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08  php8.0-swoole : Depends: php8.0-common but it is not going to be installed
#9 45.08                  Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 45.08  php8.0-xdebug : Depends: php8.0-common but it is not going to be installed
#9 45.08                  Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 45.08  php8.0-xml : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08               Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 45.08               Depends: libxml2 (>= 2.9.0) but it is not going to be installed
#9 45.08               Depends: libxslt1.1 (>= 1.1.25) but it is not going to be installed
#9 45.08  php8.0-zip : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 45.08               Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 45.08               Depends: libzip4 (>= 1.7.0) but it is not installable
#9 45.10 E: Unable to correct problems, you have held broken packages.
Copy after login

After searching, it seems that I found a solution

 Solve it with downgrade sail
 composer require laravel/sail:^1.7.0
 php artisan sail:install
 and in ubuntu terminal
 sail up --build
Copy after login

Okay, keep trying , first run

composer require laravel/sail:^1.7.0
Copy after login
Copy after login

and find an error, the specific error is forgotten.
I checked that the php version was 7.x, so I used
brew install php and found an error.

Error: Failure while executing; `cp -pR /var/folders/vq/934y4t116875gz570v8drdcm0000gn/T/d20211115-17671-1n3qf1o/openssl@1.1/. /usr/local/Cellar/openssl@1.1` exited with 1. Here's the output:cp: utimes: /usr/local/Cellar/openssl@1.1/.: Operation not permitted
cp: chmod: /usr/local/Cellar/openssl@1.1/.: Operation not permitted
Copy after login

After checking it, I didn’t have permission. I used sudo brew install. php

Error: Running Homebrew as root is extremely dangerous and no longer supported.As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
Copy after login

found that sudo is not supported.
Sosudo chown -R $(whoami) /usr/local/CellarChange directory permissions
Normal operation
Use php -vCheck the version, Or 7.0
Use
brew unlink php70
brew link php
sudo vim ~/.bash_profile
in the file Append

PATH="$(brew --prefix php)/bin:$PATH"export PYTHON_ENV=development
Copy after login

php -v
php8.0 was successfully installed at the end

PHP 8.0.12 (cli) (built: Oct 21 2021 14:49:05) ( NTS )Copyright (c) The PHP Group
Zend Engine v4.0.12, Copyright (c) Zend Technologies
Copy after login

Continue

composer require laravel/sail:^1.7.0
Copy after login
Copy after login

I found that it was not found. I thought it might be domestic There is a problem with the composer source

[InvalidArgumentException] Could not find package laravel/laravel with stability stable
Copy after login

I installed the Chinese image of composer. In fact, there was a problem with the Chinese image of composer. Later I changed it directly and changed it to another address.

composer config -g repo.packagist composer https://packagist.org
Copy after login

success.
Step 2

php artisan sail:install
Copy after login

Success.
Step Three

sail up
Copy after login

Success. Solve the problem.
Last localhost
Laravel docker sail 搭建

The above is the detailed content of Let's talk about Mac Laravel docker sail building issues. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template