Questions tagged [dockerode]

dockerode objectives:

streams - dockerode does NOT break any stream, it passes them to you allowing for some stream voodoo. stream demux - Supports optional demultiplexing. entities - containers, images and execs are defined entities and not random static methods. run - dockerode allow you to seamless run commands in a container ala docker run. tests - dockerode really aims to have a good test set, allowing to follow Docker changes easily, quickly and painlessly. feature-rich - There's a real effort in keeping All Docker Remote API features implemented and tested. interfaces - Features callback and promise based interfaces, making everyone happy

Installation npm install dockerode

Usage Input options are directly passed to Docker. Check Docker API documentation for more details. Return values are unchanged from Docker, official Docker documentation will also apply to them. Check the tests and examples folder for more examples.

35 questions
4
votes
1 answer

How can i capture stdout from dockerode when using promises?

I am trying to run a docker container using dockerode following the examples here. The issue I am having is that the output of the container prints to stdout, but I am trying to capture it and store it in a variable while using promises if…
securisec
  • 3,435
  • 6
  • 36
  • 63
3
votes
1 answer

dockerode imperative cli equivalent

I am attempting to compile & execute a java program within a dockerode container in my node app. I am able to do this by first writing to a tmp.java file using basic javascript and then running the following shell commands: docker run --rm -v…
mlz7
  • 2,067
  • 3
  • 27
  • 51
3
votes
3 answers

How to push image with dockerode? (image not pushed but no error)

I have this code: import * as Docker from 'dockerode' const docker = new Docker() const remoteDockerImage = docker.getImage(`${awsRepoUrl}:${version}`) await remoteDockerImage.push({ authconfig: { base64: 'auth token from aws' }, tag:…
Totty.js
  • 15,563
  • 31
  • 103
  • 175
2
votes
0 answers

Dockerode Equivalent of Command

I'm looking to use dockerode to run a function in nodejs that is the equivalent to the following command line command: docker run --rm -v ${filename}:/docker.py image-name I am unsure about how to do this (especially how to use flags like --rm and…
CodeRocks
  • 655
  • 5
  • 10
  • 25
2
votes
1 answer

dockerode pass args to run command _ Nodejs Docker

I created some network with these command : docker network create --driver bridge my-network and I have some docker image that already created with an dockerfile. In docker documentation they said you can connect your container with this…
Babak Abadkheir
  • 2,222
  • 1
  • 19
  • 46
2
votes
1 answer

How to get the output of the process using NodeJS dokerode library?

var Docker = require('dockerode'); var docker = new Docker({socketPath: '/var/run/docker.sock'}); var container = docker.getContainer('740aae30d312'); let params = { Cmd: ['sh','-c','ls -a $URL'], Env: ['URL=/home'], AttachStdout: true, …
2
votes
0 answers

Docker API /images/json always returns Containers:-1

As stated in the API docs https://docs.docker.com/engine/api/v1.39/#operation/ImageList an image should contain something like "Containers": 2 but for me, all images returned by the api have "Containers": -1 eventhough there are containers running…
CodingKiwi
  • 676
  • 8
  • 22
2
votes
2 answers

Docker Run command with MySQL import

I'm using dockerode for creating and running containers. I'm trying to import data to MySQL. my code: docker.run('img_cwd',['mysql', '-h', 'localhost', '-u', 'user', `-ppassword`, 'dbName', '<', …
israel berko
  • 556
  • 1
  • 5
  • 18
2
votes
1 answer

Mount a volume in docker using nodejs on windows

I try to mount a volume in docker container using nodejs app on windows. When I try this command on the cmd: docker run -it -v C:\Users\User\data:/stuff:rw ubuntu bash it works and the container contains the volume. But if I try to do this using…
GalRoimi
  • 37
  • 5
1
vote
0 answers

How to know that the container is up and running (Dockerode)?

I am running docker using dockerode's run command. let dockerEvent = docker.run('imageName', [], process.stdout, function(err) { if(err) { console.log("Error while starting docker", err); } }); I need to do something once the…
Ankit Arora
  • 110
  • 3
  • 16
1
vote
1 answer

dockerode stream "data" listener echoes write data

I'm trying to figure out why dockerode stream directs all data written to the stream directly to the output of the stream. This is how I create the container, I call the .write() method on the this.stream object. this.container = await…
David Yue
  • 713
  • 7
  • 24
1
vote
2 answers

How can I use filters in listNetworks with dockerode?

I want to list docker networks with specific name and I've tried to use options like import Docker from "dockerode"; const docker = new Docker(); const ntw = await docker.listNetworks({ Name:"qwerty" }) console.log(ntw); But when I…
bryantsuen
  • 13
  • 2
1
vote
0 answers

Copy files to Docker container using Dockerode without archiving the files

I am able to copy files to docker container by archiving the files. var dockerode = require('dockerode'); var docker = new dockerode(); var dockrContainer = docker.getContainer(containername); …
firstpostcommenter
  • 2,328
  • 4
  • 30
  • 59
1
vote
1 answer

Docker inspect contains old ip addresses after ip change

I create docker containers with a node.js app (depends on dockerode API from apocas) with multiple docker networks connected to each container. By default every container gets a random ip address for each network interface. Example: dev-container…
igi
  • 125
  • 1
  • 15
1
vote
1 answer

Run Docker container in detach mode with Dockerode

I am using Dockerode to trigger the execution of a Docker container with the following run() method. How can I run it in detach mode please? // Instantiate Docker var Docker = require("dockerode"); var docker = new Docker({ socketPath:…
Alexis.Rolland
  • 5,724
  • 6
  • 50
  • 77
1
2 3