Closed octfx closed 3 years ago
ah, I get it, you are using varnish*
commands after exec
'ing in the container right?
We changed things recently so that people could run sidecars more easily: https://github.com/varnish/docker-varnish/commit/3b38b0e1c38c1f6324ac8afa156ff73cfbbffcf4
services:
varnish:
image: varnish
volumes:
- cache-logs:/var/lib/varnish
varnish-log:
image: varnish
volumes:
- cache-logs:/var/lib/varnish
command: [varnishncsa]
volumes:
cache-logs:
driver: local
driver_opts:
type: tmpfs
device: tmpfs
but that means by default, varnishd
will start with -n /var/lib/varnish
. So, in the current situation, you have two options:
varnish*
commands with -n /var/lib/varnish
too so they find the workdir/usr/sbin/varnishd -F -f ...
so the entrypoint doesn't inject the argumentI'll check if adding aliases/trampoline scripts could be a better approach to satisfy everyone
This explains and fixes it, thank you!
latest update to the images includes "trampoline" scripts that are going to inject the -n /var/lib/varnish
as first argument before calling the real binary, so now your use case should also work transparently
I'm closing this, but let us know if you you have further issue or question about this
I stumbled into the same issue with the recent (6.0.x) image. -n
does not work for me, but using the full path to binary, does. And I noticed there are two locations for varnishlog, one is symlink to varnishd, another just a binary.
# which varnishlog
/usr/local/bin/varnishlog
# /usr/local/bin/varnishlog -V
/usr/bin/varnishlog (varnish-6.0.7 revision 525d371e3ea0e0c38edd7baf0f80dc226560f26e)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2020 Varnish Software AS
# /usr/bin/varnishlog -V
/usr/bin/varnishlog (varnish-6.0.7 revision 525d371e3ea0e0c38edd7baf0f80dc226560f26e)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2020 Varnish Software AS
# /usr/local/bin/varnishlog
.....
VSM: Could not get hold of varnishd, is it running?
# /usr/bin/varnishlog
(..)
- VCL_use boot
- Timestamp Start: 1623244019.731650 0.000000 0.000000
- BereqMethod GET
- BereqURL /
- BereqProtocol HTTP/1.1
(..)
Update: Figured out the issue. I've overridden entrypoint and have not added -n /var/lib/varnish
parameter to varnishd
. Leaving my comment here, in case anyone else has this issue.
Using
varnish:fresh
orvarnish:stable
(6.0.7+) novarnish*
command inside the docker container works.Every command outputs
Could not get hold of varnishd, is it running?
Using versions 6.0.6 or 6.5 all commands successfully connect to the daemon.
Example compose file used: