Docker for Mac beta 9 and daemon options

Does the pinata tool still work? I am trying to set daemon options with

pinata set daemon @file.json

…but to no avail. My file.json content is:

{
  "storage-driver":"aufs",
  "debug":true,
  "insecure-registries":["localhost:5000"]
}

I got it working. With “hostnet” networking you cannot expect “localhost” to work. Remember, the “pull” is a daemon thing, and inside the VM localhost is another place…

In my case I replaced “localhost” for “192.168.65.2” (the VM ip).

Thanks. Just to be clear, localhost:5000 doesn’t work even with pinata set network nat, right?

The problem with using the vm ip is that it changes, right? I guess you could add a name (like the old docker.local) in the mac /etc/hosts and refer to that in the pinata settings. It might be easier to keep /etc/hosts updated.

If your docker server has a static ip, I guess you could use that ip as long as native/port-forwarding = true. But, I imagine most people are running this on their macbook where its ip address changes whenever changing wifi.

I went into more detail on this issue in this post.

@jamshid :
I got the feeling the the latest (beta 9) release that maybe NAT won’t be available soon (I may be wrong).

I don’t think that the host’s /etc/hosts gets propagated to the VM (just tested it here and it doesn’t). Anyway the VM hostnet IP is fixed (you can change it with “pinata set network hostnet docker-ipv4=xxx host-ipv4=yyy”).

Yes, I am thinking about a moving team working on a “random” wi-fi. Me myself I carry around with me (sometimes) a Mac Mini OSX Server that does the server juggernaut role.

You’re right, OSX’s /etc/hosts is ignored by Docker for Mac.

I didn’t realize the docker ip is fixed, but I’m confused because published ports aren’t published there.

$ pinata list | grep -E '192|port-forward'
*  network = hostnet (docker-ipv4=192.168.65.2, host-ipv4=192.168.65.1)
*  native/port-forwarding = true 
$ docker ps | grep 3142
be666e42fad8        bobrik/socat                                                "socat TCP-LISTEN:314"   9 hours ago         Up 9 hours          0.0.0.0:3142->3142/tcp                                                                                               buildenv_socat_aptcacherng_1
$ docker run centos curl -fsSI http://192.168.65.2:3142
curl: (7) Failed connect to 192.168.65.2:3142; Connection refused
$ docker run centos curl -fsSI http://192.168.65.1:3142
(hangs)
curl: (7) Failed connect to 192.168.65.1:3142; Connection refused

I have to access via my macbook’s ip address.

$ ifconfig en0 | grep -w inet
	inet 192.168.2.4 netmask 0xffffff00 broadcast 192.168.2.255
$ docker run centos curl -sSI http://192.168.2.4:3142
HTTP/1.1 ...

PS: even accessing by the macbooki’s ip address does not consistently work within docker. My macbook got ip address 172.20.10.7 from a wifi network and I guess that conflicts with docker ranges, because:

$ curl -sSI http://172.20.10.7:3142
HTTP/1.1 ...
$ docker run centos curl -sSI http://172.20.10.7:3142
(hangs, fails to connect)

Yeah, it’s kinda weird but we will get used to that.

The ports will work on “docker-ipv4” IP address when called from inside the VM or inside any container.

In the Mac they are bound to the real IP and should be also bound on localhost.

The ports will work on “docker-ipv4” IP address when called from inside the VM or inside any container.

That’s not what my docker run centos curl commands showed. Does your system behave differently? If you run docker run -d -p 3142:3142 sameersbn/apt-cacher-ng on what ip addresses is that available within a container?

Oh, you’re right.

The ports will work on “docker-ipv4” IP address and “172.17.0.1” when called from inside the VM.

The ports will work on the real OSX IP address when called from inside a container.

We might be dealing here with new behaviour from Docker 1.11, not just Docker for Mac.

Maybe something got fixed in beta10, I can now access the ip address docker-ipv4 from within docker and published ports are available there.

$  docker run -d -p 9999:80 httpd
$ pinata list | grep 'docker-ipv4='
*  network = hostnet (docker-ipv4=192.168.65.2, host-ipv4=192.168.65.1)
$ docker run centos curl -fsSI http://192.168.65.2:9999
HTTP/1.1 200 OK

So, I can start a apt-cacher-ng container and my Dockerfile’s can access it at http://192.168.65.2:3142. I’m setting the actual ip using --build-arg. This is good because that ip doesn’t change when I change wifi / networks.

I have been having the same problem, I’m using Beta 14 :frowning: I opened a ticket in GitHub and here in the Forum:

@jamshid How do you get it working? Is it still working? Are you still using version 10? Thanks!

Try upgrading to latest (beta 14 now), much has changed

1 Like

@andrevtg Sorry, I’m already running version 14, not 11 :frowning:

Pinata is gone… Now I can’t use pinata list anymore.

2 Likes