-
Notifications
You must be signed in to change notification settings - Fork 98
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
Accept Docker service hostnames in addition to IP addresses in configuration. #415
Comments
Is this ticket more to be able to accept dns names or is the issue docker-compose specific? |
Removed the bug label since we explicitly call out that only ip address and port is supported in both static and dynamic configs |
It's specific to docker networks (not just compose), as I believe the DNS works the same.
I mean I think I am running in the network with compose, I'm honestly surprised it doesn't just work. I thought it was supposed to be transparent to processes running in the container. I'm testing with this code. DockerfileFROM rust:latest
WORKDIR /app
RUN cargo init --name dns-test .
RUN echo 'dns-lookup = "*"' >> Cargo.toml
COPY main.rs /app/src/main.rs
RUN cargo build
CMD ["cargo", "run"] main.rsfn main() {
println!("{:?}", dns_lookup::lookup_host("iperf:8000").unwrap());
} compose.yml dns_test:
build: .
iperf:
image: networkstatic/iperf3:latest
restart: always
ports:
- 8000:5201
command: -s |
so it seems dns only works out of the box from compose version 2 and above, I tried with the following that worked version: '2'
services:
dns_test:
build: .
iperf:
image: networkstatic/iperf3:latest
restart: always
ports:
- 8000:5201
command: -s fn main() {
println!("it were: {:?}", dns_lookup::lookup_host("iperf").unwrap());
} |
Ah the issue is with having the |
Actually I'm going to re-open because we need to be able to set the port in quilkin endpoint configuration, and I don't know how to do that without changing the serde impl, because it seems like we need to parse the host and port separately due to fn main() {
println!("it were: {:?}", "iperf".parse::<std::net::SocketAddr>().unwrap());
} |
Currently if you use a docker hostname in the configuration you'll get an error about a invalid IP address, but there are times where you need to get IP from the hostname. When I was trying to make a
docker-compose
version of theiperf3
for #410, docker compose gives services hostnames for service discovery, but these are not picked up by std's implementation ofToSocketAddrs
ordns-lookup
it seems.The text was updated successfully, but these errors were encountered: