How to pull signed docker images using dockerode NodeJS API

I have a node js application that does basic docker operations like pull images, create, run, start and stop docker containers. I am using dockerode library.
I want to enforce only trusted signed images are allowed to be pulled.
According to docker documentation, setting env variable DOCKER_CONTENT_TRUST=1. This is not feasible because I am invoking docker remotely.

Observation on command line: Without setting DOCKER_CONTENT_TRUST=1, using flag –disable-content-trust=false will force only trusted images to be downloaded.

  • Schedule a container with docker swarm using gpu memory as a constraint
  • Capturing stack frames for a particular process using perf
  • Guidance needed - how to track nginx-docker-rails performance issue
  • Rancher external subdomains
  • Share docker images between hosts with NFS
  • docker rabbitmq crashing during startup
  • [root@vm ~]# echo $DOCKER_CONTENT_TRUST
    
    [root@vm ~]# docker pull --disable-content-trust=false docker/trusttest
    Using default tag: latest
    no trust data available
    [root@vm ~]# 
    

    But, this is no effect when called from node js using dockerode api

    Here is the node code:

    function pullImage(imageId){
        return new Promise((resolve, reject)=>{
            docker.pull(imageId,{"disable-content-trust":"false"},(err,stream)=>{
                if(err){
                    console.error("Docker pull failed for:" + imageId + "error:" + err);
                    reject(err);
                }else 
                    console.log("Docker image installed: " + imageId);
                    resolve(true);
                }
            });
        });
    }
    
    
    pullImage('docker/trusttest',{}).then((v)=>{
        console.log("pull image successful", v);
    }).catch((ex)=>{
        console.error("exception in pull image", ex);
    });
    

    This code downloads the image even though disable-content-trust=false.
    The question is am I passing the option parameters to docker.pull correctly ?
    I can’t find the documentation for option parameter values for dockerode.
    Any help is much appreciated.

    Links:
    https://docs.docker.com/engine/security/trust/content_trust/

    https://github.com/apocas/dockerode

  • Copying docker image folder between partition with rsync
  • Clean up dangling Docker Containers in githost hosted gitlab-ci runners?
  • Share data between 2 containers
  • How to use docker to spin up postgres database
  • Cannot hit docker container running locally
  • Ctrl-p and Ctrl-n behaving unexpectedly under Docker
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.