在jenkins中配置Docker主机

时间:2017-11-23 13:09:27

标签: ubuntu docker jenkins

我安装了Jenkins ver。 2.73.3在Ubuntu 17.10中 同一台机器也有Docker版本17.09.0-ce。

我还在/ etc / default / docker文件中添加了以下行 DOCKER_OPTS =“docker -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock”

cat /etc/default/docker
# Docker Upstart and SysVinit configuration file

#
# THIS FILE DOES NOT APPLY TO SYSTEMD
#
#   Please see the documentation for "systemd drop-ins":
#   https://docs.docker.com/engine/admin/systemd/
#

# Customize location of Docker binary (especially for development testing).
#DOCKERD="/usr/local/bin/dockerd"

# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

DOCKER_OPTS="docker -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock"

# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"

# This is also a handy place to tweak where Docker's temporary files go.
#export DOCKER_TMPDIR="/mnt/bigdrive/docker-tmp"

----------------------------------

sudo systemctl daemon-reload
sudo service docker restart

在此之后,在Docker云的Jenkins配置页面中。我收到以下错误。请参阅随附的屏幕截图 enter image description here

1 个答案:

答案 0 :(得分:1)

在你的情况下,docker守护进程没有考虑/ etc / default / docker文件,你可以检查我在上面的文件中做了一些语法错误。 否则运行此cmd并进行一次测试。 dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375&

在触发命令之前停止所有的docker服务并杀死容器(如果有的话)

相关问题