I'm trying to manage docker via PHP curl requests. (Using Ubuntu 15.10)
I have followed API documentation but it bit confusing and also followed a few online tutorials but no luck.
This is what I have done so far, stopped docker daemon and added
script
    /usr/bin/docker -H tcp://127.0.0.1:4243 -d
end script
to
/etc/init/docker.conf
Docker daemon started
This is My PHP script
function post_to_url($url, $data, $headers) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10); //timeout in seconds
    curl_setopt($ch, CURLOPT_URL, $url);
    if ($headers != '') {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    }
    curl_setopt($ch, CURLOPT_POST, 1);
    if ($data != '') {
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
    }
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $return = curl_exec($ch);
    if ($return == '') {
        return curl_getinfo($ch, CURLINFO_HTTP_CODE);
    } else {
        return $return;
    }
    curl_close($ch);
}
//Sample API request
echo post_to_url('http://127.0.0.1:4243/containers/json', '', '');
But I did not able to get any output via CURL request?
What I'm missing here?
loclhostshould perhaps belocalhost? :)-dflag that you've added to the script in yourdocker.conffile. Perhaps you meant-D. Using the wrong flag could prevent docker from starting properly.