- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在稍微修改 this Dockerfile支持我的特定用例:我需要指定我自己的 PyPi
服务器,我们将在其中发布内部库。这通常可以通过指定 pip.conf
文件或将命令行选项传递给 pip
来实现。
我正在尝试:
FROM python:3.5
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ONBUILD COPY requirements.txt /usr/src/app/
# 1st try: set the env variable and use it implicitely. Does not work!
# ENV PIP_CONFIG_FILE pip.conf
# ONBUILD RUN pip install --no-cache-dir -r requirements.txt
# 2nd try: set once the env variable, just for this command. Does not work!
# ONBUILD RUN PIP_CONFIG_FILE=pip.conf pip install --no-cache-dir -r requirements.txt
# 3rd try: directly configure pip. Works, but these values should not be set in the Dockerfile!
ONBUILD RUN pip install --index-url http://xx.xx.xx.xx:yyyyy --trusted-host xx.xx.xx.xx --no-cache-dir -r requirements.txt
ONBUILD COPY . /usr/src/app
我的 pip.conf
非常简单,在 Docker
之外使用时也能正常工作:
[global]
timeout = 60
index-url = http://xx.xx.xx.xx:yyyyy
trusted-host = xx.xx.xx.xx
链接:
我有以下问题:
ENV
不工作?RUN
命令中显式设置变量不起作用?ONBUILD
或 RUN
是否存在这些问题?最佳答案
我遇到了同样的问题,我设法将其添加到 Dockerfile 中解决了这个问题:
COPY pip.conf pip.conf
ENV PIP_CONFIG_FILE pip.conf
RUN pip install <my_package_name>
pip.conf 文件具有以下结构:
[global]
timeout = 60
index-url = https://pypi.org/simple
trusted-host = pypi.org
<my_server_page>
extra-index-url = https://xxxx:yyyy@<my_server_page>:<package_location>
这是我找到的唯一让 Docker 从 pypi 服务器找到包的方法。我希望这个解决方案是通用的,可以帮助其他遇到这个问题的人。
关于python - 在 dockerfile 中自定义 ONBUILD 环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38180964/
我正在尝试使用谷歌云构建触发器来构建我的 docker 容器。不幸的是,构建没有找到我的 docker 文件。它不在我的存储库的根目录中,但我认为我可以指定一个相对路径。显然我配置错误了。下面是我的
我可以像这样构建一个 Dockerfile docker build -t deepak/ruby . 但是对于一个不名为Dockerfile的Dockerfile # DOCKER-VERSION
是否可以命名构建阶段?我正在搜索类似以下示例的内容: ARG NAME FROM python:3.7-alpine as modul-${NAME} # ... 如果我尝试这个例子,就会发生这个错误
在我的 Dockerfile 中,我需要使用命令替换来添加一些环境变量。我想设置 ENV PYTHONPATH /usr/local/$(python3 -c 'from distutils impo
以下Dockerfile包含四个COPY层: COPY README.md ./ COPY package.json ./ COPY gulpfile.js ./ COPY __BUILD_NUMBE
我正在尝试从我创建的 Dockerfile 中拉取 tomcat,并使用以下命令拉取 centos: FROM centos RUN docker run -it tomcat 然后现在我正在创建一个
我不确定是否应该为我的 Node.js 应用程序创建不同的 Dockerfile 文件。一种用于没有开发依赖项的生产,另一种用于包含开发依赖项的测试。 或者一个基本上是开发Dockerfile.dev
我拥有的是多个相似且简单的dockerfile 但我想要的是有一个单一的基础 dockerfile 和我的 dockerfile将他们的变量传递给它。 在我的例子中,dockerfile 之间的唯一区
我有一个应用程序有两个 Dockerfile ,说 Dockerfile.foo和 Dockerfile.bar ,预计将为 docker-compose.yml 的两个不同服务生成两个不同的图像.
我是一个 docker maven 插件新手。 如果我理解得很好,根据Spotify's Dockerfile Maven documentation ,应该将 Dockerfile 放在我的项目的根
我正在设置一个docker容器,将在this article之后在nginx服务器上为我的Angular 5应用程序提供服务。 本文提出了这个Dockerfile: # Stage 0, based
大家好, 我是 docker 的新手,我想容器化我的 ASP.NET Core 应用程序,但出现错误,我无法继续构建我的图像 这是我的示例 Dockerfile FROM microsoft/dotn
我想在不使用注册表的情况下链接 Dockerfiles,这可以通过 FROM 实现吗?陈述? 以两个 Dockerfile 为例: Dockerfile /some/other/dir/Dockerf
我尝试在公共(public) dockerhub 上通过我自己的镜像安装 Airflow,但它在本地运行完美,但当我尝试在 Openshift 上使用它时。我在下面收到此错误。 `ERROR: Cou
此 dockerfile 工作正常。但是如何在 dockerfile 中执行命令? FROM alpine RUN apk add --update sqlite && rm -rf /var/cac
当我尝试设置自动构建时,我的 Docker Hub 存储库中的 Dockerfile 为空。如果我触发构建:- Build failed: Dockerfile not found at ./Dock
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题?通过 editing this post 添加详细信息并澄清问题. 1年前关闭。 Improve this
我目前正在将一个巨大的 DockerFile 拆分为单独的 DockerFile,但是在巨大的 DockerFile 中定义的一些变量需要在单独的 DockerFile 中使用。 Docker 是否有
我有一个 Dockerfile 可以创建我想在这里使用的构建镜像:~/build/Dockerfile 然后我使用一个标准镜像来部署 从 ~/build/Dockerfile 构建的图像没有在任何地方
我运行这个: ➜ frontend git:(master) ✗ docker-compose up Building web ERROR: Cannot locate specified Dock
我是一名优秀的程序员,十分优秀!