2017-07-07 36 views
0

我隨後在https://docs.docker.com/samples/docker/提供的說明,即無法連接到多克爾在多克爾

docker run --privileged --name some-docker -d docker:dind 

然而,我無法連接到搬運工服務。

docker run -i -t --rm --link some-docker:docker docker:latest version  

Client: 
Version:  17.06.0-ce 
API version: 1.30 
Go version: go1.8.3 
Git commit: 02c1d87 
Built:  Fri Jun 23 21:15:15 2017 
OS/Arch:  linux/amd64 
Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running? 

我能夠遠程登錄,當我打開通過

docker run -i -t --rm --link some-docker:docker docker:latest /bin/sh 

/# telnet docker 2375 
l 
HTTP/1.1 400 Bad Request 
Content-Type: text/plain; charset=utf-8 
Connection: close 

400 Bad RequestConnection closed by foreign host 

終端在同一容器中運行的結果docker -H docker info

docker -H docker info 
Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running? 

然而,如果我建立一個基於Ubuntu的碼頭工人與碼頭安裝使用以下Dockerfile

FROM ubuntu:latest 

RUN apt-get update && apt-get -y install \ 
    apt-transport-https \ 
    ca-certificates \ 
    curl \ 
    software-properties-common 

RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - 

RUN add-apt-repository \ 
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ 
    $(lsb_release -cs) \ 
    stable" 

RUN apt-get update && apt-get -y install docker-ce 

我能夠連接到泊塢窗功能於泊塢窗:

docker build -t docker-ubuntu . 
docker run -i -t --rm --link some-docker:docker docker-ubuntu:latest /bin/sh 
# docker -H docker info 
Containers: 0 
Running: 0 
Paused: 0 
Stopped: 0 
Images: 0 
Server Version: 17.06.0-ce 
Storage Driver: vfs 
Logging Driver: json-file 
Cgroup Driver: cgroupfs 
Plugins: 
Volume: local 
Network: bridge host macvlan null overlay 
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog 
Swarm: inactive 
Runtimes: runc 
Default Runtime: runc 
Init Binary: docker-init 
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a 
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4 
init version: 949e6fa 
Security Options: 
seccomp 
    Profile: default 
Kernel Version: 4.9.27-moby 
Operating System: Alpine Linux v3.6 (containerized) 
OSType: linux 
Architecture: x86_64 
CPUs: 2 
Total Memory: 1.952GiB 
Name: b39967739fb9 
ID: NDIF:PU7X:NA4B:IMI4:UH7V:VL4G:Q6L5:DPKP:NKDH:2XH6:XYDB:F2AV 
Docker Root Dir: /var/lib/docker 
Debug Mode (client): false 
Debug Mode (server): false 
No Proxy: *.local, 169.254/16 
Registry: https://index.docker.io/v1/ 
Experimental: false 
Insecure Registries: 
127.0.0.0/8 
Live Restore Enabled: false 

WARNING: bridge-nf-call-iptables is disabled 
WARNING: bridge-nf-call-ip6tables is disabled 

我在泊塢窗-CE的Mac OS X以及搬運工人-CE爲Ubuntu都嘗試。同樣的結果。有任何想法嗎?

+0

前兩個命令的工作就像在我的OSX魅力。嘗試更新您的基本圖像,以放棄一些版本控制問題:'碼頭拉碼頭:dind &&碼頭拉碼頭:最新' – Robert

+0

Thx @Robert。我已經有了最新的圖像,但顯然我的Docker for Mac落後了1個版本。更新它並重置它現在的所有功能後。在Ubuntu上它仍然無法正常工作。碼頭版本是最新的。即使完全擦除/ var/lib/docker後,問題仍然存在 –

回答

0

- 特權並不意味着您有權訪問docker-socket,而是訪問所有設備/ dev和更多。

這就是說,一定要卷裝入泊塢窗插座插入容器

docker run -v /var/run/docker.sock:/var/run/docker.sock

或搬運工,compose.yml模擬

+0

他正在嘗試使用docker-in-docker圖像(dind)。僅安裝主機的docker.sock將允許訪問該泊塢窗,但他正嘗試啓動一個新的泊塢窗(泊塢窗中的泊塢員) – Robert