Docker Jenkins Image - curl:(3)在URL中找到非法字符

时间:2016-02-11 17:38:23

标签: windows jenkins docker

我创建了以下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脚本应该在构建容器内而不是在Windows上运行。

1 个答案:

答案 0 :(得分:9)

您应该检查plugins.txt文件中的换行符。如this answer中所述,问题可能是由Windows和Mac OS之间的不同行结尾引起的。