jumppad icon indicating copy to clipboard operation
jumppad copied to clipboard

Fix DOCKER_HOST default to include unix:// path prefix

Open Zortaniac opened this issue 1 year ago • 2 comments

The default for the docker_host() function does not include the unix:// path prefix. This causes issues when used in exec resources.

Zortaniac avatar Dec 13 '23 10:12 Zortaniac

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.

nicholasjackson avatar Jan 12 '24 07:01 nicholasjackson

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.

Zortaniac avatar Apr 02 '24 09:04 Zortaniac