I'm trying to get Varnish to run in a container, and I'm running into a weird issue. Things work fine if I log in, and then execute from a command line, but when I try to run it, using the same command, from Docker, it seems fails (I'm guessing it's not picking up the configs properly). Any ideas?
$ docker run --add-host "web:127.0.0.1" -ti my-proxy /bin/bash
root@f81c7d3ca1c6:/# /usr/sbin/varnishd -F -f /etc/varnish/default.vcl -a :80 -T localhost:6082 -S /etc/varnish/secret -s malloc,256m
child (24) Started
Child (24) said Child starts
^CManager got SIGINT
Stopping Child
root@f81c7d3ca1c6:/# exit
$ docker run --add-host "web:127.0.0.1" my-proxy
WARNING: (-sfile) file size reduced to 0 (80% of available disk space)
child (14) Started
Pushing vcls failed:
CLI communication error (hdr)
Stopping Child
Child (14) died signal=6
Child (14) Panic message: Assert error in smf_open_chunk(), storage_file.c line 403:
Condition(sz != 0) not true.
thread = (cache-main)
ident = Linux,4.0.9-boot2docker,x86_64,-sfile,-smalloc,-hcritbit,no_waiter
Backtrace:
0x430935: /usr/sbin/varnishd() [0x430935]
0x44b2cf: /usr/sbin/varnishd() [0x44b2cf]
0x44b561: /usr/sbin/varnishd() [0x44b561]
0x449a57: /usr/sbin/varnishd(STV_open+0x27) [0x449a57]
0x42f74f: /usr/sbin/varnishd(child_main+0xbf) [0x42f74f]
0x44255f: /usr/sbin/varnishd() [0x44255f]
0x442e62: /usr/sbin/varnishd(MGT_Run+0x1d2) [0x442e62]
0x40c2c0: /usr/sbin/varnishd(main+0x930) [0x40c2c0]
0x7f9ccbc40ec5: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f9ccbc40ec5]
0x40c644: /usr/sbin/varnishd() [0x40c644]
Child (-1) said Child starts
Child cleanup complete
manager dies
Here's the Docker command:
CMD ["/usr/sbin/varnishd", "-F", "-f", "/etc/varnish/default.vcl", "-a", ":80", "-T", "localhost:6082", "-S", "/etc/varnish/secret", "-s", "malloc,256m"]
The failure here was totally Docker, and not related at all to Varnish. I had been doing a bunch of builds, and it turns out the issue was I was out of inodes.
https://gist.githubusercontent.com/michaelneale/1366325a7737c4cb80b0/raw/4a61279d8498758111533589d1de648a9a31f691/docker-clean
Running both of these solved my problem.