Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

328
Views
Docker Compose Hostname DNS Lookup Fails

I have a simple Docker compose file as below:

version: '3'
services:
  server:
     build: ./server
     networks:
        - common
     ports:
        - "4840:4840"
     container_name: open62541_server
     hostname: open62541-server
  client:
    build: ./client
    depends_on:
       - server
    container_name: open62541_client
    networks:
        - common

networks:
    common:

When I run it, I get the following error:

Attaching to open62541_server, open62541_client
open62541_server | [2019-06-27 12:19:54.864 (UTC+0000)] info/network    TCP network layer listening on opc.tcp://open62541-server:4840/
open62541_client | [2019-06-27 12:19:55.590 (UTC+0000)] warn/network    DNS lookup of open62541-server failed with error Name or service not known
open62541_client exited with code 0

Even after specifying that the containers belong to a common network, why is that I get this error? Is there anything I'm missing?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You should use server (service name) as host to which you connect within docker-compose network instead of open62541-server as neither container_name nor hostname section in docker file affects docker-compose's internal DNS.

over 4 years ago · Santiago Trujillo Report

0

You probably have a typo in the config file. hostname is open62541-server and container_name is open62541_server (with underscore). You should be able to connect to server with either the service name (i.e. server) or container_name (i.e. open62541_server)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!