Bitbucket 使用多个 FROM 管道处理 docker 镜像?

发布于 2025-01-11 02:02:48 字数 607 浏览 3 评论 0原文

首先,我是 Docker 的新手!我目前正在尝试创建自己的 docker 映像,我可以在我的 bitbucket 管道中使用它。我想做的是将节点和 ruby​​ 安装在同一个容器上。这是我当前的 Dockerfile 的样子:

FROM node:12.22.10

FROM ruby:2.7.5

我已经构建、标记并推送了该映像,并在我的 bitbucket-pipelines.yml 中使用它,并且我正在尝试运行此步骤脚本:

script:
    - yarn install
    - gem install bundler -v 2.2.29

当在管道中运行时,我收到此错误:

bash: yarn: command not found

我尝试了一些方法,我删除了 FROM ruby​​:2.7.5 并且纱线命令有效,但显然 <代码>宝石安装捆绑器... 没有。所以,我知道 Dockerfile 和镜像正在工作,但我不知道如何在我自己的 Dockerfile 中使用这两个镜像。有谁知道我做错了什么?

First of all, I'm brand new to Docker! I am currently trying to create my own docker image which I can use in my bitbucket pipelines. What I am trying to do is install node and ruby on the same container. Here is what my current Dockerfile looks like:

FROM node:12.22.10

FROM ruby:2.7.5

I've built, tagged and pushed this image and use it in my bitbucket-pipelines.yml and I'm trying to run this step script:

script:
    - yarn install
    - gem install bundler -v 2.2.29

When this is run in the pipeline I get this error:

bash: yarn: command not found

I've tried a couple of things, I removed the FROM ruby:2.7.5 and the yarn command worked but obviously the gem install bundler... did not. So, I know that the Dockerfile and image are working but I don't know how to use both images in my own Dockerfile. Does anyone know what I'm doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文