Ask Your Question

Trying puppet/puppetserver docker image and getting Failed to open TCP connection to puppet:8140

asked 2017-10-18 22:58:15 -0600

ns408 gravatar image

updated 2017-10-18 22:59:36 -0600


I am trying the latest puppet/puppetserver docker image and while getting the following error:

root@a25018447d66:/# puppet resource user `whoami`
Error: Could not run: Failed to open TCP connection to puppet:8140 (getaddrinfo: Name or service not known)

While I understand that I can modify /etc/hosts to have puppet as the hostname, I'm trying to find out why I'm getting this error while I'm trying to find out information about a resource on a node locally.

Thanks in advance.

edit retag flag offensive close merge delete


Hi, The error seems to be self explanatory, this system is not able to resolve the domain name puppet. Can you try to run "ping puppet" and share feedback?

stivesso gravatar imagestivesso ( 2017-10-19 06:51:21 -0600 )edit

There's no hostname named puppet defined I can confirm. But why does `puppet resource` command has to connect to a socket to get this information while all I am trying to do is to get this information from local system.

ns408 gravatar imagens408 ( 2017-10-19 22:28:04 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-11-08 10:11:03 -0600

stivesso gravatar image

Hi NS408,

The same Issue was raised on and the explanation is quite simple:
The agent images will, by default, try and connect to a Puppet master at puppet:8140. So if you don't have one (either via linking or a container with the correct network name, or a DNS record inserted at runtime for instance) then this would be expected.

Note that puppet/puppetserverdocker image will send reports to a PuppetDB instance on on https://puppetdb. Meaning that you need to have a running puppetdb to avoid hitting that error. You can see below the relevant error related to puppetdb when running "puppet resource user"

root@2c6d6a1014b6:/# puppet resource user
Warning: Error connecting to puppetdb on 8081 at route /pdb/query/v4/resources?query=%5B%22%3D%22%2C%22certname%22%2Cnull%5D%5D%5D, error message received was 'Failed to open TCP connection to puppetdb:8081 (getaddrinfo: Name or service not known)'. Failing over to the next PuppetDB server_url in the 'server_urls' list
Error: Could not run: Could not retrieve resources from the PuppetDB at puppet:8140: Failed to execute '/pdb/query/v4/resources?query=%5B%22%3D%22%2C%22certname%22%2Cnull%5D%5D%5D' on at least 1 of the following 'server_urls': https://puppetdb:8081

Now, If you are not using PuppetDB, then the puppet/puppetserver-standalone docker image is strongly advised as a better choice. In facts, I tested the same with that image and you can see the output below :-)

root@3b5d6a1014b6:/# puppet resource user `whoami`
user { 'root':
  ensure           => 'present',
  comment          => 'root',
  gid              => 0,
  home             => '/root',
  password         => '*',
  password_max_age => 99999,
  password_min_age => 0,
  shell            => '/bin/bash',
  uid              => 0,
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-10-18 22:58:15 -0600

Seen: 288 times

Last updated: Nov 08 '17