Skip to content

Node warning with ssh:// URL in DOCKER_HOST #184

@mhgoldman

Description

@mhgoldman

The warning below appears when DOCKER_HOST is set to a URL like ssh://[email protected]:8313:

(node:38257) [DEP0170] DeprecationWarning: The URL ssh:hostname.com:8313hostname.com is invalid. Future versions of Node.js will throw an error.
    at getHostname (node:url:518:17)
    at Url.parse (node:url:386:14)
    at urlParse (node:url:143:13)
    at Object.urlResolve [as resolve] (node:url:720:10)
    at Modem.dial (/Users/mgoldman/src/myproj/node_modules/docker-modem/lib/modem.js:155:19)
    at /Users/mgoldman/src/myproj/node_modules/dockerode/lib/docker.js:1381:18
    at new Promise (<anonymous>)
    at Docker.ping (/Users/mgoldman/src/myproj/node_modules/dockerode/lib/docker.js:1380:12)

node v23.11.0
docker-modem v5.0.6

Repro code:

Modem = require('docker-modem');
process.env.DOCKER_HOST = 'ssh://[email protected]:8313';

modem = new Modem();
modem.dial({ path: '/v1.41/containers/json', method: 'GET' }, (err, result) => {
  if (err) {
    console.error("Error (expected since no real SSH tunnel exists):", err);
  } else {
    console.log("Result:", result);
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions