Build for step builder failed due to dial unix /var/run/docker.sock: connect: connection refused
Closed this issue · 4 comments
I'm trying to build a dev container on my OSX machine for an existing Rails app, which uses some private gems so needs my ssh key passed in (which is what brought me to this project!). I can't get past the part where it's trying to connect to a Docker socket.
This is the command I'm running:
sudo habitus_darwin_amd64 -f ./config/containers/build.yml --build host=$(ipconfig getifaddr en0) --host unix:///var/run/docker.sock --binding=$(ipconfig getifaddr en0) --secrets=true
Which returns
2017/05/29 13:27:20 ▶ Using './config/containers/build.yml' as build file
2017/05/29 13:27:20 ▶ Collecting artifact information
2017/05/29 13:27:20 ▶ Building 1 steps
2017/05/29 13:27:20 ▶ Step 0 - builder: builder
2017/05/29 13:27:20 ▶ Parallel build for builder
2017/05/29 13:27:20 ▶ Building builder
2017/05/29 13:27:20 ▶ Parsing and converting 'Dockerfile'
2017/05/29 13:27:20 ▶ Starting API on 8080
2017/05/29 13:27:20 ▶ Writing the new Dockerfile into Dockerfile.generated
2017/05/29 13:27:20 ▶ Building the builder image from Dockerfile.generated
2017/05/29 13:27:28 ▶ Build for step builder failed due to dial unix /var/run/docker.sock: connect: connection refused
build.yml just contains:
build:
version: 2016-03-14
steps:
builder:
name: builder
dockerfile: Dockerfile
secrets:
id_rsa:
type: file
value: _env(HOME)/.ssh/id_rsa
cleanup:
commands:
- rm -rf /root/.ssh/
docker info
returns:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.05.0-ce
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.4.66-boot2docker
Operating System: Boot2Docker 17.05.0-ce (TCL 7.2); HEAD : 5ed2840 - Fri May 5 21:04:09 UTC 2017
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.955GiB
Name: default
ID: D7ID:PG7A:X2I2:L2VD:FXSP:7VXH:YYPN:T25R:VNMS:ZHYJ:5BAV:RC7Z
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 16
Goroutines: 24
System Time: 2017-05-29T19:22:35.212446204Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
provider=virtualbox
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
What am I missing?
Hi @MathieuGilbert this happening when you miss an extra '/' in your --host setting.
--host=unix:///var/run/docker.sock
will work of mac.
--host=unix://var/run/docker.sock
gives you the error.
can you check you use the right name of the sock?
Thanks @kamerblauwlicht. If I use unix://
(or a different path), it gives a different error:
Build for step builder failed due to dial unix /run/docker.sock: connect: no such file or directory
"No such file or directory" vs "connection refused", so it seems like the command is correct, just some config isn't allowing a connection to the VM's docker process.
Does this depend on my local machine's Docker or Virtualbox config?
it does depend how you install your docker engine. if you use the Docker runtime on Mac you use unix:///var/run/docker.sock but if you run inside a VM using Linux you use unix://var/run/docker.sock
Ok, I guess I'll try reinstalling all the Docker and Habitus components and starting from scratch with a simple app. I just thought it might be a Habitus issue since I'm able to build the Docker container on its own (just without the SSH key). Thanks anyways!