-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed as not planned
Closed as not planned
Copy link
Description
Environment
- Platform: Ubuntu 22.04.2
- Docker Version: 24.0.2
- Node.js Version: 18.17.1
- Image Tag: 18.17
Expected Behavior
Node should be able to resolve the names of containers in the same docker network via DNS even if these names contain dots.
Current Behavior
Node throws an error with code ENODATA.
Possible Solution
I don't have any idea at the moment.
Steps to Reproduce
# Create docker network `test`
docker network create test
# Run containers attached to the same network `test` so that they can resolve their names
docker run -d --name test3.0 --network test node:18.17 bash -c 'while true; do date; sleep 10; done'
docker run -d --name test3.4 --network test node:18.17 bash -c 'while true; do date; sleep 10; done'
# Switch to container test3.0
docker exec -it test3.0 bash
# This should show that the name of test3.4 is properly resolvable
ping -c 1 -i 1 test3.4
# This should show that test3.4 is not properly resolvable for node
node
const dns = require('dns');
dns.resolve('test3.4', (err, data) => console.log(err, data));This produces the following output for me:
> dns.resolve('test3.4', (err,dat) => console.log(err,dat));
QueryReqWrap {
bindingName: 'queryA',
callback: [Function (anonymous)],
hostname: 'test3.4',
oncomplete: [Function: onresolve],
ttl: false
}
> Error: queryA ENODATA test3.4
at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/callback_resolver:47:19)
at QueryReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
errno: undefined,
code: 'ENODATA',
syscall: 'queryA',
hostname: 'test3.4'
} undefined
Additional Information
The problem is not reproducible with the node:18.16 image and the problem does not occur if the names don't contain dots. Furthermore, name resolution is working properly for ping.
Metadata
Metadata
Assignees
Labels
No labels