Docker Jenkins Image - curl:(3)在 URL 中发现非法字符
Posted
技术标签:
【中文标题】Docker Jenkins Image - curl:(3)在 URL 中发现非法字符【英文标题】:Docker Jenkins Image - curl: (3) Illegal characters found in URL 【发布时间】:2016-02-11 17:38:22 【问题描述】:我创建了以下 Dockerfile 来创建 Jenkins 容器。 它在 OSX 上成功运行,但是当我在 Windows 7 上尝试时,在构建容器时出现以下错误。
Sending build context to Docker daemon 32.26 kB
Step 1 : FROM jenkins:latest
---> 997d1b2b89a5
Step 2 : COPY plugins.txt /var/jenkins_home/plugins.txt
---> Using cache
---> 632e6f94438c
Step 3 : RUN /usr/local/bin/plugins.sh /var/jenkins_home/plugins.txt
---> Running in a56c01d8afe0
Downloading credentials:1.24
curl: (3) Illegal characters found in URL
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
The command '/bin/sh -c /usr/local/bin/plugins.sh /var/jenkins_home/plugins.txt' returned a non-zero code: 3
这是我的 Dockerfile
FROM jenkins:latest
COPY plugins.txt /var/jenkins_home/plugins.txt
RUN /usr/local/bin/plugins.sh /var/jenkins_home/plugins.txt
# Adding default Jenkins Jobs
COPY jobs/unit-test-adapter.xml /usr/share/jenkins/ref/jobs/unit-test- adapter/config.xml
############################################
# Configure Jenkins
############################################
# Jenkins settings
COPY config/config.xml /usr/share/jenkins/ref/config.xml
# Jenkins Settings, i.e. Maven, Groovy, ...
COPY config/hudson.tasks.Maven.xml /usr/share/jenkins/ref/hudson.tasks.Maven.xml
COPY config/maven-global-settings-files.xml /usr/share/jenkins/ref/maven- global-settings-files.xml
# SSH Keys & Credentials
COPY config/credentials.xml /usr/share/jenkins/ref/credentials.xml
COPY config/ssh-keys/id_rsa /usr/share/jenkins/ref/.ssh/id_rsa
COPY config/ssh-keys/id_rsa.pub /usr/share/jenkins/ref/.ssh/id_rsa.pub
有谁知道可能是什么问题?我很困惑plugins.sh
script 应该在构建容器内而不是在 Windows 上运行。
【问题讨论】:
如果您发布 plugins.txt 会有所帮助。 【参考方案1】:您应该检查plugins.txt
文件中的换行符。如this answer 中所述,此问题可能是由 Windows 和 Mac OS 之间的不同行尾引起的。
【讨论】:
感谢这工作!问题是因为当我在 Windows 上签出我的 git 存储库时,它会将plugins.txt
文件转换为 CRLF。
我刚刚使用以下行创建了一个.gitattributes
文件,并将其保持为 LF 格式。 * -text
以上是关于Docker Jenkins Image - curl:(3)在 URL 中发现非法字符的主要内容,如果未能解决你的问题,请参考以下文章