Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCKER_HOST not taken into account #525

Closed
socotra69 opened this issue Aug 13, 2021 · 1 comment · Fixed by #756
Closed

DOCKER_HOST not taken into account #525

socotra69 opened this issue Aug 13, 2021 · 1 comment · Fixed by #756
Labels
kind/bug Something isn't working

Comments

@socotra69
Copy link

socotra69 commented Aug 13, 2021

What happened:

  • In a context where the docker host is different from the default configuration, the docker services cannot works.
    In other word, the DOCKER_HOST env var is not used by the program.
  • in my case in did not work in a docker dind context setted up on a bitbucket pipeline

What you expected to happen:
DOCKER_HOST env var should be the law.

How to reproduce it (as minimally and precisely as possible):
Create a docker service and expose it from another host.
Set the DOCKER_HOST var on the machine.
Validate conf with a simple docker run busybox.
Start horusec

Anything else we need to know?:
It is related to the docker client creation.

dockerClient, err := docker.NewClientWithOpts(docker.WithAPIVersionNegotiation())

it should be :
dockerClient, err := docker.NewClientWithOpts(docker.FromEnv)

Environment:

  • Horusec version (use horusec version): latest
  • Operating System: linux / docker dind
  • Network plugin / Tool and version (if this is a network-related / tool bug):
  • Others:
@socotra69 socotra69 added the kind/bug Something isn't working label Aug 13, 2021
@wiliansilvazup
Copy link
Contributor

Hello @socotra69

Sorry for the delay in returning and we really appreciate the feedback.
This is a very interesting idea, the engineering team will check as soon as possible to inform you about this change and its impacts on Horusec-CLI

If the impact on the tool is low, it is a very valid exchange, otherwise we will have to assess how we can make the appropriate change without impacting user interaction.

matheusalcantarazup added a commit that referenced this issue Nov 9, 2021
Previously when an user use a different DOCKER_HOST we was not able to
connect because we was not reading the environment variables.

This commit change the docker client initialization to read
configuration from environment variables if they exists.

Fixes #525

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
matheusalcantarazup added a commit that referenced this issue Nov 9, 2021
Previously when an user use a different DOCKER_HOST we was not able to
connect because we was not reading the environment variables.

This commit change the docker client initialization to read
configuration from environment variables if they exists.

Fixes #525

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
matheusalcantarazup added a commit that referenced this issue Nov 9, 2021
Previously when an user use a different DOCKER_HOST we was not able to
connect because we was not reading the environment variables.

This commit change the docker client initialization to read
configuration from environment variables if they exists.

Fixes #525

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
matheusalcantarazup added a commit that referenced this issue Nov 9, 2021
Previously when an user use a different DOCKER_HOST we was not able to
connect because we was not reading the environment variables.

This commit change the docker client initialization to read
configuration from environment variables if they exists.

Fixes #525

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants