kamal icon indicating copy to clipboard operation
kamal copied to clipboard

Temporary failure in name resolution

Open Tekchanddagar opened this issue 1 year ago • 1 comments

Hello Team, I am using kamal to deploy my ruby app. Below is the part of my kamal config/deploy.yml file:

# Name of your application. Used to uniquely configure containers.
service: wcf-app

# Name of the container image.
image: devops/wcf-stag-kamal-image
# Deploy to these servers.
servers:
 web:
   hosts:
     - 17.9.45.6
  # options:
  #    publish:
  #     - "3600:3600"
   labels:
     traefik.enable: true
ssh:
  user: deploy
  port: 911

accessories:
  redis:
    image: redis 
    roles:
      - web
    options:
      publish:
        - "6379:6379"

Now i used below commands to run my app:

  1. kamal accessory boot redis
  2. kamal deploy

I can see 3 container i.e redis, traefik and my app container are up. I have used REDIS_HOST=wcf-app-redis and REDIS_PORT=6379 in my app. But its not reachable from my app container.

Then i tried to debug this issue and check below points:

  1. I can confirm all the 3 container redis, app and traefik are in same network i.e bridge
  2. All the 3 container are reachable to each other when i am pining using container IP.
  3. But when i tried to use name of container wcf-app-redis unable to ping and getting Temporary failure in name resolution.

As we can't use IP for connection and its not working via name of container.

Can you please help me whats is the issue/mistake i am doing here.

Thank You

Tekchanddagar avatar Sep 27 '24 17:09 Tekchanddagar

Hello Team, I am able to figure out the issue. My app and accessory redis were using default docker network bridge. And it support conatiner IP not DNS.

So i have created new docker network and used same for all 3 conatiner:

# Name of your application. Used to uniquely configure containers.
service: wcf-app

# Name of the container image.
image: devops/wcf-stag-kamal-image
#build: false
# Deploy to these servers.
servers:
 web:
   hosts:
     - 10.10.0.34
   options:
      network: wcf-app-network
  #    publish:
  #     - "3600:3600"
   labels:
     traefik.enable: true

traefik:
  options:
    network: wcf-app-network
  args:
    providers.docker.network: wcf-app-network

ssh:
  user: deploy
  port: 911

accessories:
  redis:
    image: redis  # Use the official Redis image
    roles:
      - web
    options:
       network: wcf-app-network
       publish:
        - "6379:6379"

But i need to create docker network manually on host machine. Can we create docker network using kamal config/deploy.yml file?

Thank You

Tekchanddagar avatar Sep 28 '24 03:09 Tekchanddagar

Hi @Tekchanddagar. Kamal 2 will automatically create a kamal network and create all containers including accessories in it. Does that solve your problem here?

djmb avatar Sep 30 '24 07:09 djmb