>  기사  >  PHP 프레임워크  >  Mac Laravel 도커 항해 구축 문제에 대해 이야기해 보겠습니다.

Mac Laravel 도커 항해 구축 문제에 대해 이야기해 보겠습니다.

藏色散人
藏色散人앞으로
2021-11-16 14:47:002532검색

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 搭建

예전에 TP를 사용했었는데 TP버전이 업데이트되어서 이제 집어들게 되었습니다. 매우 불친절해서 이번엔 Laravel을 한번에 사용했습니다. 먼저 도커 환경부터 시작해 보겠습니다. 모두가 저와 소통하고 더 많은 것을 가르쳐 주실 수 있습니다. 또한 내 초보자 경험이 일부 사람들에게 도움이 되기를 바랍니다. 🎜🎜【추천: 🎜laravel 튜토리얼🎜】🎜🎜🎜🎜1. Docker Desktop 설치🎜🎜포럼의 자세한 튜토리얼🎜🎜🎜🎜2. 컨테이너 실행("피트" 발생!)🎜🎜방금 튜토리얼을 따랐습니다. 단계별 작업, 6번째 단계까지 작업이 원활하지 않았으며 다음과 같은 상황이 발생했습니다🎜
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
🎜로그를 잘 살펴보니 🎜
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.
🎜에 오류가 표시되었습니다. 문제가 있는 것 같은 종속 항목이 많이 있습니다🎜
PATH="$(brew --prefix php)/bin:$PATH"export PYTHON_ENV=development
🎜더 높은 버전이 설치되어 있어야 하므로 apt-getapt-get과 달리 aptitude로 교체해 보았습니다. > 종속성을 처리하는 데 더 좋습니다. 예를 들어 aptitude가 패키지를 삭제하면 해당 패키지가 종속된 패키지도 삭제됩니다. 이런 방식으로 쓸모없는 패키지가 시스템에 남지 않으며 전체 시스템이 더 깨끗해집니다. 🎜🎜그래서 Dockerfile🎜
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
🎜을 🎜
composer require laravel/sail:^1.7.0
🎜로 조정하고 다시 실행해봤습니다🎜./vendor/bin/sail up🎜상황이 달라졌으나 여전히 오류가 발생했습니다🎜
[InvalidArgumentException] Could not find package laravel/laravel with stability stable
🎜 설치가 안되어 그냥 실행했어요🎜apt-get install -f를 해봤지만 여전히 효과가 없습니다🎜🎜글쎄요, 위에서 언급한 상위 버전 이후로 생각을 바꿔서 살펴봤습니다. 설치되었으니 상위 우분투 기반으로 할테니 FROM을 🎜
composer config -g repo.packagist composer https://packagist.org
🎜에서 🎜
php artisan sail:install
🎜로 수정했습니다. 알겠습니다. 새로운 종속성 문제가 발생했습니다🎜
sail up
🎜검색해 보니 찾은 것 같습니다. 해결책 🎜rrreee🎜좋아요, 계속 시도해 보세요. 먼저 🎜rrreee🎜를 실행하고 오류를 찾으세요. 특정 오류를 잊어버렸습니다. 🎜 확인해 보니 php 버전이 7.x라서 🎜brew install php 를 했는데 오류가 나더군요 🎜rrreee🎜 확인해보니 권한이 없어서 sudo 를 사용했습니다. Brew install php🎜rrreee 🎜 sudo가 지원되지 않는 것으로 확인되었습니다. 🎜그래서 sudo chown -R $(whoami) /usr/local/Cellar가 디렉터리 권한을 변경했습니다🎜정상적으로 실행되었습니다🎜php -v를 사용하여 버전을 확인했는데, 여전히 7.0🎜 🎜brew unlink php70🎜brew link php🎜sudo vim ~/.bash_profile🎜파일 끝에 🎜rrreee를 추가하세요. 🎜php -v 🎜php8.0이 성공적으로 설치되었습니다🎜rrreee🎜Continue🎜rrreee🎜찾지 못해서 국내 작곡가 소스에 문제가 있는 줄 알고🎜rrreee🎜설치했습니다. 중국 작곡가 이미지 문제. 나중에 다른 주소로 직접 변경🎜rrreee🎜성공. 🎜2단계🎜rrreee🎜성공. 🎜3단계🎜rrreee🎜성공. 문제를 해결하세요. 🎜마지막 로컬 호스트🎜🎜🎜

위 내용은 Mac Laravel 도커 항해 구축 문제에 대해 이야기해 보겠습니다.의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 learnku.com에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제