怎么搭建Mac Laravel docker sail

技术怎么搭建Mac Laravel docker sail本篇内容介绍了“怎么搭建Mac Laravel docker sail”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一

本篇内容介绍了"怎么搭建Mac Laravel码头工人帆"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

一. docker Desktop安装

论坛里详细教程

二. 运行容器(遇到「坑」了!)

我就是按照教程一步一步操作的,直到第六步我的运行并没有很顺利,出现了以下情况

错误:服务。测试'未能构建:版本失败我在仔细看了一下日志,错误出现在

# 97.166某些包没有安装。这可能意味着您已经

# 97.166 requestedanimmelestationorifyouareusing usting able

# 97.166尚未创建一些必需的包的分发

# 97.166 orbeenmovedoutof注射。# 97.166 he following information mayhelptorex solvention : # 97.166 # 97.166 he following package shaveminhededependencies : # 97.262 GnuPG :取决于: gpgv(2。2 .19-3ubuntu 2。1 ~)但是2 .20-1ubuntu 3仍未安装

# 97.264 perl :取决于: perl-base=(5。30 .0-9ubuntu 0。2)但5 .32 .1-3ubuntu 2。一已安装

# 97.264内存: netbasebittisnoting待安装

# 97.264 perl-base : break 3360 perl(5。32 .1 ~)但是5 .30 .0-9ubuntu 0。安装了2个

# 97.265 zlib1g-dev :取决于: zlib1g(=1:1)。2 .11 .dfsg-2ubuntu 1。2)但是1:1 .2 .11 .dfsg-2ubuntu 6是一个嵌入式系统

# 97.265取决于: libc 6-devnbsp

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

有很多依赖貌似有问题

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

应该是更高的版本被安装了,于是我尝试替换apt-get使用aptitudeapt-get 不同的是,aptitude 在处理依赖问题上更佳一些。举例来说,aptitude 在删除一个包时,会同时删除本身所依赖的包。这样,系统中不会残留无用的包,整个系统更为干净。

于是我调整了一下Dockerfile

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 \

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

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

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

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

FROM ubuntu:21.04

改到了

FROM ubuntu:latest

好吧,新的依赖问题来了

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

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

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

好,继续尝试,首先运行

composer require laravel/sail:^1.7.0

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

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

看了一下是没权限,使用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.

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

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

php -v
php8.0安装成功

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

发现没有没有找到,想到可能是国内composer源有问题

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

我是安装了composer 的中国镜像,其实就是composer 的中国镜像出了问题,后来我直接把他改了,换成另外一个地址就行了

composer config -g repo.packagist composer https://packagist.org

成功。
第二步

php artisan sail:install

成功。
第三步

sail up

“怎么搭建Mac Laravel docker sail”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!

内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/96656.html

(0)

相关推荐

  • 香港轻量云服务器拥有哪些功能

    技术香港轻量云服务器拥有哪些功能了解轻量云服务器的来龙去脉将使您更容易确定正确的服务类型。下面是我们总结的一些轻量云服务器的功能和用途。1.超高流量网站 如果您管理一个流量超高的网站,轻量云服务器是适合您网站的服务。如果

    礼包 2021年12月9日
  • oracle表碎片的整理分析

    技术oracle表碎片的整理分析本篇文章给大家分享的是有关oracle表碎片的整理分析,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

    攻略 2021年11月12日
  • JQuery如何删除UL最后一个li

    技术JQuery如何删除UL最后一个li本篇内容主要讲解“JQuery如何删除UL最后一个li”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“JQuery如何删除UL最后一个l

    攻略 2021年11月15日
  • 桂花的样子描写,描写桂花样子,赞扬他的精神的段落

    技术桂花的样子描写,描写桂花样子,赞扬他的精神的段落打我小时候便有了这棵桂花树。它不是太壮桂花的样子描写,也不是太高,却算得上是高龄了。想想小时候,真的很“幼稚”。奶奶说,那就是夜晚天上月亮里的那棵树哩!而那时天真的我却

    生活 2021年10月27日
  • INNODB引擎的4大特性

    技术INNODB引擎的4大特性 INNODB引擎的4大特性1、插入缓存
    2、二次写
    3、自适应哈希
    4、预读
    一、插入缓存(insert buffer)
    插入缓冲(insert Buffer/Chang

    礼包 2021年11月26日
  • CF 1500 C

    技术CF 1500 C CF 1500 CCF 1500 C
    题意:
    ? 给你两个 \(n \times m\) 的矩阵 A,B(1 \(\leq\) n,m \(\leq\) 1500),矩阵的元素均

    礼包 2021年11月30日