How should a docker engine call look like when issued from within one of the app containers

  docker, docker-engine

I am a beginner with docker. I want to run a docker engine api call from within one of my docker containers – specifically list all images (images/json endpoint). I am trying to troubleshoot this, and want to see the issue live from the command line.

I am struggling to figure out what is the host I should be using in the curl request form within a container (this post seems to be related, but I tried all what is suggested there without success). Tried container ip (taken from ifconfig), localhost, service name as defined in the docker-compose yml file. Nothing works.

This post seem to instruct how to do that. But again the suggestion does not work for me: curl --unix-socket /var/run/docker.sock http://images/json. This returns {"message":"page not found"}

Any help would be highly appreciated.

Source: Docker Questions