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

Wrong DOCKER_HOST config when using docker.host configuration #649

Closed
ntcong opened this issue Nov 26, 2018 · 4 comments · Fixed by #998
Closed

Wrong DOCKER_HOST config when using docker.host configuration #649

ntcong opened this issue Nov 26, 2018 · 4 comments · Fixed by #998
Assignees
Labels
Milestone

Comments

@ntcong
Copy link

ntcong commented Nov 26, 2018

vscode-docker tell me to set docker.host in the format <ip>:<port>. When using Docker build image command, it'll set DOCKER_HOST = docker.host config.

DOCKER_HOST config should be tcp://<ip>:<port>. Using <ip>:<port> will result in an error:
parse <ip>:<port>: first path segment in URL cannot contain colon

@ntcong
Copy link
Author

ntcong commented Nov 28, 2018

changing https://github.com/Microsoft/vscode-docker/blob/4d7b773fabd8c210ff7392bcc1daffc66b862004/commands/utils/TerminalProvider.ts#L20 from DOCKER_HOST: value to DOCKER_HOST: "tcp://" + value works. But i'm not sure we should use the correct DOCKER_HOST format (tcp://host:port) for docker.host configuration, or add tcp:// to the DOCKER_HOST environment

@Hanqing-Sun
Copy link

same here, thanks for the workaround!

@PrashanthCorp
Copy link
Contributor

Hey @ntcong, you are correct. Looking at how the host prefix is used by the upstream library (docker-modem), there seem to be multiple allowed protocols. I don't think it's appropriate for us to make assumptions about wanting a tcp connection. We'll look into making this more visible.

@zxfishhack
Copy link

setting docker.host to tcp://host:port does not work for me.

source from docker-modem

    var parsed = url.parse(self.host);
    address = url.format({
      'protocol': parsed.protocol || self.protocol,
      'hostname': parsed.hostname || self.host,
      'port': self.port
    });
    address = url.resolve(address, options.path);

when host is tcp://192.168.1.1, options.path is /containers, self.port is 8080, the final address will be 'tcp:/containers'.

DockerClient::refreshEndpoint, the errorMessage defind is 'The docker.host configuration setting must be entered as :, e.g. dockerhost:2375'

IMO, vscode-docker accept : only and export DOCKER_HOST=tcp://: to terminal is better.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants