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: use docker client to validate requirements #757

Closed
matheusalcantarazup opened this issue Nov 9, 2021 · 2 comments
Closed

docker: use docker client to validate requirements #757

matheusalcantarazup opened this issue Nov 9, 2021 · 2 comments
Labels
good first issue Good for newcomers kind/improvement This issue is not a Bug nor a Feature

Comments

@matheusalcantarazup
Copy link
Contributor

matheusalcantarazup commented Nov 9, 2021

What would you like to be added:
When we validate the docker requirements we use exec.Command to execute docker commands and check if docker is running and if it's on minimum version required. Although it works well, a better approach would be to use the client from NewDockerClient and use the method Ping to check version and verify if the daemon is running.

Why is this needed:
Since we are using different approaches to execute docker commands, we can have inconsistency when running them. Before #756 get merged when we set the DOCKER_HOST env the requirements execute successfully (the docker cli read env correctly) but when we start the containers we get errors because we was using an client without reading the environment variables.

@matheusalcantarazup matheusalcantarazup added good first issue Good for newcomers kind/improvement This issue is not a Bug nor a Feature labels Nov 9, 2021
@luiguip
Copy link
Contributor

luiguip commented Jan 31, 2022

I managed to get the version with the dockerClient.ServerVersion. How the error log of the function execDockerVersion from the file docker.go has to be formatted?
The exec.Command returns the response bytes when occurs an error.
The dockerClient.ServerVersion returns an empty types.Version struct.
The errors.New expects a string.

@matheusalcantarazup
Copy link
Contributor Author

matheusalcantarazup commented Jan 31, 2022

SemverVersion return an error, you can use this error instead of creating a new of one using the response from exec.Command.

matheusalcantarazup pushed a commit that referenced this issue Feb 1, 2022
Fixes ##757

Signed-off-by: Luis Guilherme de A <luisguilhermepdea@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/improvement This issue is not a Bug nor a Feature
Projects
None yet
Development

No branches or pull requests

2 participants