在drupal模板项目上运行Lando start或rebuild后如何阻止此错误返回

Posted

技术标签:

【中文标题】在drupal模板项目上运行Lando start或rebuild后如何阻止此错误返回【英文标题】:How do I stop this error from returning after running Lando start or rebuild on a drupal template project 【发布时间】:2020-01-01 22:25:06 【问题描述】:

每次我在使用drupal 8 模板安装的项目上运行lando startlando rebuild 时都会收到此错误。

我已经重做composer create projectcomposer installlando destroylando rebuild 等。没有一个工作。我还检查了我是否拥有landocomposerdocker 的最新版本。所以我不确定这是代码中的问题还是其他问题。

OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"cd\": executable file not found in $PATH": unknown
error: Looks like one of your build steps failed! with Error
    at module.exports.sh.Promise.try.then (/snapshot/lando/build/cli/lib/shell.js:0:0)
From previous event:
    at Shell.sh (/snapshot/lando/build/cli/lib/shell.js:0:0)
    at Object.exports.dc (/snapshot/lando/build/cli/lib/bootstrap.js:0:0)
    at compose (/snapshot/lando/build/cli/lib/bootstrap.js:0:0)
    at exports.run.Promise.each.docker.isRunning.then.then (/snapshot/lando/build/cli/lib/router.js:0:0)
From previous event:
    at exports.run.Promise.each.datum (/snapshot/lando/build/cli/lib/router.js:0:0)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)
From previous event:
    at Object.exports.run (/snapshot/lando/build/cli/lib/router.js:0:0)
    at run (/snapshot/lando/build/cli/lib/engine.js:0:0)
    at exports.eventWrapper.daemon.up.then.then (/snapshot/lando/build/cli/lib/router.js:0:0)
From previous event:
    at Object.exports.eventWrapper (/snapshot/lando/build/cli/lib/router.js:0:0)
    at Engine.module.exports.constructor.engineCmd (/snapshot/lando/build/cli/lib/engine.js:0:0)
    at Engine.run (/snapshot/lando/build/cli/lib/engine.js:0:0)
    at Object.exports.runBuild (/snapshot/lando/build/cli/plugins/lando-services/lib/utils.js:0:0)
    at AsyncEvents.module.exports.app.events.on.app.events.on (/snapshot/lando/build/cli/plugins/lando-services/app.js:0:0)
    at AsyncEvents.handle (/snapshot/lando/build/cli/lib/events.js:0:0)
    at emit.Promise.each.fn (/snapshot/lando/build/cli/lib/events.js:0:0)
From previous event:
    at AsyncEvents.emit (/snapshot/lando/build/cli/lib/events.js:0:0)
    at module.exports.start.initAndReport.then.then.then (/snapshot/lando/build/cli/lib/app.js:0:0)
From previous event:
    at App.start (/snapshot/lando/build/cli/lib/app.js:0:0)
    at Object.exports.appToggle (/snapshot/lando/build/cli/plugins/lando-core/lib/utils.js:0:0)
    at Object.run (/snapshot/lando/build/cli/plugins/lando-core/tasks/start.js:0:0)
    at module.exports.parseToYargs.checkForUpdates.then.lando.bootstrap.then.lando.events.emit.then.then.then.then.then (/snapshot/lando/build/cli/lib/cli.js:0:0)
From previous event:
    at module.exports.parseToYargs.checkForUpdates.then.lando.bootstrap.then.lando (/snapshot/lando/build/cli/lib/cli.js:0:0)
From previous event:
    at module.exports.parseToYargs.checkForUpdates.then (/snapshot/lando/build/cli/lib/cli.js:0:0)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)
From previous event:
    at Object.handler (/snapshot/lando/build/cli/lib/cli.js:0:0)
    at Object.runCommand (/snapshot/lando/build/cli/node_modules/yargs/lib/command.js:238:44)
    at Object.parseArgs [as _parseArgs] (/snapshot/lando/build/cli/node_modules/yargs/yargs.js:1063:30)
    at Function.get [as argv] (/snapshot/lando/build/cli/node_modules/yargs/yargs.js:1004:21)
    at Cli.run (/snapshot/lando/build/cli/lib/cli.js:0:0)
    at lando.bootstrap.then.lando.getApp.init.then (/snapshot/lando/build/cli/bin/lando.js:0:0)
From previous event:
    at lando.bootstrap.then.lando (/snapshot/lando/build/cli/bin/lando.js:0:0)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)
From previous event:
    at Object.<anonymous> (/snapshot/lando/build/cli/bin/lando.js:0:0)
    at Module._compile (pkg/prelude/bootstrap.js:1254:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:711:10)
    at Module.load (internal/modules/cjs/loader.js:610:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:549:12)
    at Function.Module._load (internal/modules/cjs/loader.js:541:3)
    at Function.Module.runMain (pkg/prelude/bootstrap.js:1309:12)
    at startup (internal/bootstrap/node.js:274:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:608:3)
warn: This **MAY** prevent your app from working
warn: Check for errors above, fix them, and try again

尽管出现此错误,我仍收到有效的网址。

编辑:添加 docker-compose.yml 文件 ...

version: '2'

services:
  solr:
    image: solr:8.1
    ports:
     - "8983:8983"
    volumes:
      - data:/opt/solr/server/solr/d8
      - ./tests/solr-conf/8.x:/solr-conf/conf
    entrypoint:
      - docker-entrypoint.sh
      - solr-precreate
      - d8
      - /solr-conf
volumes:
  data:

【问题讨论】:

复制者:***.com/questions/48001082/…。以下内容也应该对您有所帮助:***.com/questions/35452760/… 我使用lando 作为 composer 和 docker 的包装器,所以仔细查看并没有真正让我知道我可以做些什么来修复它。 starting container process caused "exec: \"cd\" - 这意味着你的Dockerfile 有一个CMDEntrypoint 语句,其中PATH 可能是cd - 找不到非常基本的bash。尝试分享Dockerfile 看起来你正在用javascript执行bashcd命令)......如果你添加你的Dockerfile,我会改变投票。 当然,您希望我发布哪个 dockerfile?在项目文件中有 'docker-compose.yml' 和一个 'docker.yml' 文件。 【参考方案1】:

我觉得不错:

$ docker-compose up
Creating network "***-57693461_default" with the default driver
Creating volume "***-57693461_data" with default driver
Pulling solr (solr:8.1)...
8.1: Pulling from library/solr
9cc2ad81d40d: Pull complete
(...)
f059ff7111be: Pull complete
Digest: sha256:6731556f68c4b8df2b1681f5a021014e9e1378c8a658ff90aa41a5071223e743
Status: Downloaded newer image for solr:8.1
Creating ***-57693461_solr_1 ... done
Attaching to ***-57693461_solr_1
solr_1  | Executing /opt/docker-solr/scripts/solr-precreate d8 /solr-conf
solr_1  | Executing /opt/docker-solr/scripts/precreate-core d8 /solr-conf
solr_1  | Created d8
solr_1  | Starting Solr 8.1.1
solr_1  | OpenJDK 64-Bit Server VM warning: Failed to reserve shared memory. (error = 1)
solr_1  | OpenJDK 64-Bit Server VM warning: Failed to reserve shared memory. (error = 1)
solr_1  | OpenJDK 64-Bit Server VM warning: Failed to reserve shared memory. (error = 1)
solr_1  | 2019-08-30 19:28:43.820 INFO  (main) [   ] o.e.j.u.log Logging initialized @912ms to org.eclipse.jetty.util.log.Slf4jLog
(...)
solr_1  | 2019-08-30 19:28:45.789 INFO  (main) [   ] o.e.j.s.AbstractConnector Started ServerConnector@1937eaffHTTP/1.1,[http/1.1, h2c]0.0.0.0:8983
solr_1  | 2019-08-30 19:28:45.789 INFO  (main) [   ] o.e.j.s.Server Started @2883ms

你是如何执行容器的?通过lando start,我想?我想知道docker.yaml 中有什么。这个docker-compose.yaml 是直截了当的。我不 看不出有什么问题。

【讨论】:

这是在我的 docker.yml 文件中:# Drupal4Docker example dev: root: /var/www/html extra-options: docker-compose exec --user=82 php type: container

以上是关于在drupal模板项目上运行Lando start或rebuild后如何阻止此错误返回的主要内容,如果未能解决你的问题,请参考以下文章

text Lando设置模板文件 - ngnix

Lando 无法从我系统上的非 Lando 应用程序访问 URL

Drupal 7 新的自定义模板

drupal 8 支持主题化预处理节点获取段落项目的函数

节点类型上的Drupal页面模板

Drupal 8将当前nid传递给块模板