标签: docker-dind

从docker里面运行docker是否可以?

我在Docker容器中运行Jenkins.我想知道Jenkins容器是否也可以成为Docker主机?我正在考虑的是从Jenkins内部为每个集成测试构建启动一个新的docker容器(以启动数据库,消息代理等).因此,在完成集成测试后应关闭容器.有没有理由避免以这种方式从另一个docker容器内运行docker容器?

jenkins docker docker-dind

156
推荐指数
4
解决办法
7万
查看次数

为自己的docker注册表提供dockerd的SSL证书

如何在gitlab-ci管道中为自己的docker注册表提供自己的CA Root证书和SSL客户端证书(cert + key)到dockerd?

我有虚拟机(CentOS 7)并安装了docker和gitlab-runner.跑步者注册为docker:dind.安装工作正常,但我无法连接到我自己的docker注册表,该注册表具有来自我自己的CA的证书,但也使用客户端SSL证书.当我转到dockerd参数时,--insecure-registry=gitlab.mazel.tov:4567它不会验证CA,但我仍然不知道如何提供客户端SSL证书,并且pipile将失败并显示此错误.

$ docker login -u gitlab-ci-token -p $CI_JOB_TOKEN https://gitlab.mazel.tov:4567
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://gitlab.mazel.tov:4567/v2/: error parsing HTTP 400 response body: invalid character '<' looking for beginning of value: "<html>\r\n<head><title>400 No required SSL certificate was sent</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>400 Bad Request</h1></center>\r\n<center>No required SSL certificate was sent</center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"
Run Code Online (Sandbox Code Playgroud)

我也有docker中的文件夹:带有我的证书的dind容器,但这种方法不起作用dockerd?但是在我的电脑或服务器上它运行正常.

$ ls -la /etc/docker/certs.d/gitlab.mazel.tov\:4567/ …
Run Code Online (Sandbox Code Playgroud)

ssl docker gitlab-ci docker-registry docker-dind

11
推荐指数
1
解决办法
527
查看次数

如何在没有日志的情况下在后台运行dockerd

我正在使用franela/dind图像来获取 bash:

docker run --rm --privileged -it franela/dind bash
Run Code Online (Sandbox Code Playgroud)

*确保/etc/docker/daemon.json在运行前删除dockerd

在里面我跑了dockerd,它开始打印很多日志:

WARN[2019-02-24T13:40:16.902536038Z] could not change group /var/run/docker.sock to docker: group docker not found 
INFO[2019-02-24T13:40:16.922239343Z] libcontainerd: started new docker-containerd process  pid=880
INFO[2019-02-24T13:40:16.922290278Z] parsed scheme: "unix"                         module=grpc
INFO[2019-02-24T13:40:16.922302876Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2019-02-24T13:40:16.922360290Z] ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/docker-containerd.sock 0  <nil>}]  module=grpc
INFO[2019-02-24T13:40:16.922373417Z] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-02-24T13:40:16.922423556Z] pickfirstBalancer: HandleSubConnStateChange: 0xc4203c96e0, CONNECTING  module=grpc
INFO[0000] starting containerd …
Run Code Online (Sandbox Code Playgroud)

containers docker docker-dind

10
推荐指数
1
解决办法
8553
查看次数

Docker中的Docker - SSL问题

我在CI管道中使用Docker In Docker for Jenkins Slaves.

我遇到过有关SSL的问题.问题是maven无法访问位于我们Nexus仓库中的工件,它只是挂起.

我尝试使用curl进行调试.

在DinD容器内,一切都很好:

$ curl -I https://www.google.com
HTTP/1.1 200 OK
Run Code Online (Sandbox Code Playgroud)

但是,如果我运行:

bash-4.3# curl -I --insecure  https://nexus.eng.myco.com/nexus
curl: (35) Unknown SSL protocol error in connection to nexus.eng.myco.com:443`
Run Code Online (Sandbox Code Playgroud)

它挂了很长时间然后我收到这个错误:

curl: (35) Unknown SSL protocol error in connection to nexus.eng.myco.com:443`
Run Code Online (Sandbox Code Playgroud)

我可以将问题curl语句运行一级(运行问题docker容器的docker容器),一切都很好.

我应该注意,如果我在我的笔记本电脑上运行有问题的DinD容器(不是在DinD中),它没有问题.

使用调试信息更新:

bash-4.3#  curl -v -I https://nexus.eng.myco.com/nexus/content/groups/this>
*   Trying 54.164.137.27...
* Connected to nexus.eng.my.com (44.164.137.27) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: …
Run Code Online (Sandbox Code Playgroud)

ssl curl jenkins docker docker-dind

6
推荐指数
1
解决办法
911
查看次数

使用 docker-dind 时,如何让非 root 用户访问 docker?

我正在尝试使用 docker-dind 运行 Go CD 代理来自动构建我的一些 docker 映像。

我无法让用户go访问 docker 守护进程。

当我尝试访问 docker info 时,我得到以下信息:

[go] Task: /bin/sh ./builder.shtook: 2.820s
[START]
[USER]  go
[TAG]  manual

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.32/containers/fish/angular-cli/json: dial unix /var/run/docker.sock: connect: permission denied
Sending build context to Docker daemon  3.072kB

Step 1/8 : FROM node:8-alpine
 ---> 4db2697ce114
Step 2/8 : MAINTAINER jack@fish.com
 ---> Using cache
 ---> 22f46bf6b4c1
Step 3/8 : VOLUME /usr/local/share/.cache/yarn/v1
 ---> Using …
Run Code Online (Sandbox Code Playgroud)

docker go-cd docker-dind

1
推荐指数
1
解决办法
3584
查看次数