首页 文章

在jenkins中配置Docker主机

提问于
浏览
0

我已经安装了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 Cloud 的Jenkins配置页面中 . 我收到以下错误 . 请参阅随附的屏幕截图
enter image description here

1 回答

  • 1

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

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

相关问题