jumppad
jumppad copied to clipboard
Fix DOCKER_HOST default to include unix:// path prefix
The default for the docker_host() function does not include the unix:// path prefix. This causes issues when used in exec resources.
Hey @Zortaniac, thanks for this; this never had unix:// prefixed to it because we always used this function to mount the default docker sock into a container. The name needs to be more accurate from the intention; you are, however, correct, and this should be updated. I will create a separate PR that combines your changes with a new function for getting the docker sock.
I have also fixed all the tests for the project, which was long overdue from when we moved to the new HCL config package. I will update the tests for you.
Hey @nicholasjackson, the problem I see with your approach is, that you derive the value from the environment DOCKER_HOST. The default (if unset) for DOCKER_HOST is unix:///var/run/docker.sock, so you have to expect the unix:// prefix anyway. The same problem occurs for environments with remote docker servers using tcp://.
For now I will just set DOCKER_HOST explicitly if not set, but would be great to get this working to be able to pass the environment variable to exec resources.