Dockerode: adding build-arg to buildImage

Created on 9 Jan 2017  Â·  1Comment  Â·  Source: apocas/dockerode

I am trying to build a docker image using the --build-arg flag that is available in the cli. I have tried doing

docker.buildImage(tar, {
   t: 'tagname',
   'build-arg' : ['NPM_TOKEN=mynpmtoken'] 
}, (err, output) => {
    //some code
});

as well as

docker.buildImage(tar, {
   t: 'tagname',
   'build-arg' : 'NPM_TOKEN=mynpmtoken' 
}, (err, output) => {
    //some code
});

Is there any way to achieve what I am trying to do, or is this not supported?

question

Most helpful comment

docker-cli is also a Docker Remote API client like dockerode is, so you need to check RAPI's documentation.

https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/build-image-from-a-dockerfile

Is it supported:
buildargs – JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for command(s) run via the Dockerfile’s RUN instruction or for variable expansion in other Dockerfile instructions. This is not meant for passing secret values.

>All comments

docker-cli is also a Docker Remote API client like dockerode is, so you need to check RAPI's documentation.

https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/build-image-from-a-dockerfile

Is it supported:
buildargs – JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for command(s) run via the Dockerfile’s RUN instruction or for variable expansion in other Dockerfile instructions. This is not meant for passing secret values.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IniZio picture IniZio  Â·  3Comments

knight42 picture knight42  Â·  6Comments

AlexanderCollins picture AlexanderCollins  Â·  5Comments

peterpetre picture peterpetre  Â·  6Comments

lgomez picture lgomez  Â·  3Comments