docker - 为 .deb 文件创建 dockerfile
问题描述
我想为在 ubuntu 18.04 上运行的 debian 文件扩展名创建一个 dockerfile。到目前为止我已经写了这个
FROM ubuntu:18.04 AS ubuntu
RUN apt-get update
WORKDIR /Downloads/invisily
RUN apt-get install ./invisily.deb
除了最后一个阶段,所有阶段都运行良好。它显示了这个错误:
E: Unsupported file ./invisily.deb given on commandline
The command '/bin/sh -c apt-get install ./invisily.deb' returned a non-zero code: 100
我是码头工人和云的新手,所以任何帮助将不胜感激,谢谢!
编辑:我通过将 dockerfile 和 debian 文件放在同一目录中并使用 COPY 来解决它。./ 这就是我的 dockerfile 现在的样子:
FROM ubuntu:18.04 AS ubuntu
RUN apt-get update
WORKDIR /invisily
COPY . ./
USER root
RUN chmod +x a.deb && \
apt-get install a.deb
解决方案
一些东西,
- WORKDIR 是容器内的工作目录。
- 在构建 Docker 映像时,您需要将文件 invisily.deb 从本地复制到您的容器。
- 您可以在 RUN 字段中传递多个 bash 命令,并将它们与多行结合起来。
尝试这样的事情
FROM ubuntu:18.04 AS ubuntu
WORKDIR /opt/invisily
#Drop the invisily.deb in to the same directory as your Dockerfile
#This will copy it from local to your container, inside of /opt/invisily dir
COPY invisily.deb .
RUN apt-get update && \
chmod +x invisily.deb && \
apt-get install invisily.deb
推荐阅读
- android - .findViewById() 返回 null
- numpy - Numpy、OOP 和可调用对象
- azure-active-directory - 在创建帐户之前使用 ADB2C 电话因素技术配置文件来验证电话号码
- regex - awk 正则表达式 (REGEX) 从文件中获取电话号码
- python - 如何在只有几列的行中替换值而不在 Pandas 中合并
- r - 如何使用 readtext 将多个 JSON 文件加载到 quanteda 语料库中?
- regex - 匹配包含括号的 RegEx 文本字符串
- javascript - 如何在纯 JavaScript 中选择嵌套元素?
- javascript - 如何在 html 中制作像 mx player 这样的视频播放器?
- cuda - NVIDIA 架构:CUDA 线程和线程块