Heim  >  Artikel  >  PHP-Framework  >  Lassen Sie uns über die Probleme beim Docker-Segelbau von Mac Laravel sprechen

Lassen Sie uns über die Probleme beim Docker-Segelbau von Mac Laravel sprechen

藏色散人
藏色散人nach vorne
2021-11-16 14:47:002532Durchsuche

多 多 多

apt-get使用aptitudeapt-get 不同的是,aptitude 在处理依赖问题上更佳一些。举例来说,aptitude 在删除一个包时,会同时删除本身所依赖的包。这样,系统中不会残留无用的包,整个系统更为干净。

于是我调整了一下Dockerfile

ERROR: Service 'laravel.test' failed to build : Build failed

变成了

#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.

再次运行
./vendor/bin/sail up
情况变得不同了,但依然报了错误

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

并没有安装成功,只是执行了过去
又尝试了apt-get install -f但依然没什么效果

好吧,换个思路观察了一下,既然说的更高版本已经安装,那我就基于更高的ubuntu去做,于是我修改了FROM,从

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

改到了

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 \

好吧,新的依赖问题来了

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

搜索了一下,貌似找到了一个解决方案

FROM ubuntu:21.04

好,继续尝试,首先运行

FROM ubuntu:latest

发现报错,具体错误忘记了。
我看了一下php版本是7.x于是使用
brew install php 发现报错

#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.

看了一下是没权限,使用sudo brew install php

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

发现sudo不支持。
于是sudo chown -R $(whoami) /usr/local/Cellar改变目录权限
正常运行
使用php -v看了一下版本,还是7.0
使用
brew unlink php70
brew link php
sudo vim ~/.bash_profile
在文件末尾追加

composer require laravel/sail:^1.7.0

php -v





Laravel docker sail 搭建

🎜🎜🎜 🎜🎜🎜 🎜🎜🎜 🎜🎜🎜 🎜🎜🎜 🎜🎜🎜 🎜🎜🎜 🎜🎜🎜 🎜🎜🎜 Jetzt habe ich es mir zugelegt. Früher habe ich TP verwendet, aber die TP-Version wurde aktualisiert Sehr unfreundlich, daher habe ich Laravel dieses Mal in einem Schritt verwendet. Beginnen wir zunächst mit der Docker-Umgebung. Ich werde versuchen, im Laufe der Zeit mit mir zu interagieren und mir mehr beizubringen. Ich hoffe auch, dass meine Erfahrung als Neuling einigen Menschen helfen kann. 🎜🎜【Empfohlen: 🎜laravel-Tutorial🎜🎜🎜🎜🎜1. Docker Desktop-Installation🎜🎜Ausführliches Tutorial im Forum🎜🎜🎜🎜2. Ausführen des Containers (auf eine „Grube“ gestoßen!)🎜🎜Ich habe gerade das Tutorial befolgt Schritt für Schritt Betrieb, bis zum sechsten Schritt war mein Betrieb nicht sehr reibungslos und es trat die folgende Situation auf: 🎜
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
🎜Ich habe mir das Protokoll genau angesehen, der Fehler ist in 🎜
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.
aufgetreten. Es gibt viele Abhängigkeiten, die problematisch zu sein scheinen 🎜Es sollte eine höhere Version installiert sein, also habe ich versucht, apt-get durch aptitude zu ersetzen. Im Gegensatz zu apt-get, aptitude > Besser im Umgang mit Abhängigkeiten. Wenn aptitude beispielsweise ein Paket löscht, werden auch die Pakete gelöscht, von denen es abhängt. Auf diese Weise bleiben keine unnötigen Pakete im System und das gesamte System wird sauberer. 🎜🎜Also habe ich die Docker-Datei🎜
PATH="$(brew --prefix php)/bin:$PATH"export PYTHON_ENV=development
🎜 auf 🎜
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
🎜 angepasst und sie erneut ausgeführt🎜./vendor/bin/sail up🎜Die Situation wurde anders, aber der Fehler wurde trotzdem gemeldet🎜
composer require laravel/sail:^1.7.0
🎜 Die Die Installation war nicht erfolgreich, ich habe sie einfach ausgeführt🎜Ich habe apt-get install -f versucht, aber es hatte immer noch keine Wirkung🎜🎜Nun, ich habe es mir anders überlegt und es mir seit der oben erwähnten höheren Version angesehen wurde installiert. Dann werde ich es basierend auf höherem Ubuntu tun, also habe ich FROM von 🎜
[InvalidArgumentException] Could not find package laravel/laravel with stability stable
🎜 in 🎜
composer config -g repo.packagist composer https://packagist.org
🎜 geändert. Ok, es ist ein neues Abhängigkeitsproblem aufgetreten🎜
php artisan sail:install
🎜Nach der Suche scheint es Gefunden zu sein eine Lösung 🎜
sail up
🎜Okay, versuchen Sie es weiter, führen Sie zuerst 🎜rrreee🎜 aus und finden Sie einen Fehler. Ich habe den spezifischen Fehler vergessen. 🎜Ich habe nachgesehen und die PHP-Version war 7.x, also habe ich 🎜brew install php verwendet und einen Fehler gefunden 🎜rrreee🎜Nach der Überprüfung hatte ich keine Berechtigung, also habe ich sudo verwendet brew install php🎜rrreee 🎜 Es wurde festgestellt, dass sudo nicht unterstützt wird. 🎜Also hat sudo chown -R $(whoami) /usr/local/Cellar die Verzeichnisberechtigungen geändert. 🎜Es lief normal. 🎜Ich habe php -v verwendet, um die Version zu überprüfen immer noch 7.0🎜Verwenden Sie 🎜brew unlink php70🎜brew link php🎜sudo vim ~/.bash_profile🎜Hängen Sie 🎜rrreee am Ende der Datei an 🎜php -v 🎜php8.0 wurde erfolgreich installiert. 🎜rrreee Das chinesische Bild des Komponisten, das eigentlich das chinesische Bild des Komponisten ist, habe ich später direkt in eine andere Adresse geändert🎜rrreee🎜Erfolg. 🎜Schritt 2🎜rrreee🎜Erfolg. 🎜Schritt 3🎜rrreee🎜Erfolg. Probleme lösen. 🎜Letzter lokaler Host🎜🎜🎜

Das obige ist der detaillierte Inhalt vonLassen Sie uns über die Probleme beim Docker-Segelbau von Mac Laravel sprechen. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Dieser Artikel ist reproduziert unter:learnku.com. Bei Verstößen wenden Sie sich bitte an admin@php.cn löschen