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
0
votes
0 answers

How to pass stdin inputs to a docker container and run a piece of code within the container?

I have a gcc container that compiles a piece of code and gives me the output. The code that has to be run within the container has a "cin>>" to read the input from the terminal. I am using dockerode for the application and the code, input to the…
Krithiik
  • 13
  • 5
0
votes
0 answers

Dockerode can not get list of running containers

I'm trying to get the list of containers using Dockerode + Javascript code. Although I can see containers running in Docker Desktop, Dockerode doesn't seem to pick up the list of containers. I've tried the fix in this thread: After executing…
Anugerah Erlaut
  • 990
  • 13
  • 23
0
votes
1 answer

Trying to read file from dockerode returning unwanted encoded characters?

I'm using dockerode and a read stream using the cat command to resolve the contents of a file, however I'm also getting encoded characters that I assume are for defining a file format. I know I could remove them by removing x characters from the…
Finbar
  • 1,127
  • 1
  • 5
  • 17
0
votes
1 answer

How to make an API call from dynamically created container to a container which is part of another network?

My simplified docker compose file services: myapp: volumes: - /var/run/docker.sock:/var/run/docker.sock networks: - mynetwork ports: - 3000:3000 networks: mynetwork: I run these two commands to up my…
LoneRanger
  • 665
  • 13
  • 31
0
votes
0 answers

Writing on stdin when using dockerode

How can I write to the container's stdin, when using dockerode library? I tried doing it in a multiple ways, but nothing seems to work. My current code that is not able to write to stdin: export async function nameToStdName( pluginName: string, …
0
votes
1 answer

Creating mysqldump in node with dockerode is resulting in a file with wrong mime-type

I'm creating an application that should do a mysqldump from mysql running in a docker container. The application i'm creating is build in node. This is the script that i'm using. const containerId = '71501a8ab0f8'; const database = 'my-db'; const…
0
votes
0 answers

How to pass a file to docker container and get output from the container into node app using dockerode

I am writing a simple script in nodejs that will pass a file to a docker container, the container will process the file and generate a json output. I am using Dockerode to connect to the docker container. the input file is in the same folder as the…
pranit
  • 128
  • 1
  • 1
  • 8
0
votes
0 answers

Dockerode won't build image

I am trying to build an image using Dockerfile present in a given directory (using dockerode in Node.js). const Dockerode = require("dockerode"); const dockerode = new Dockerode(); const image_path = "./images/cpp/Dockerfile"; const image_tag =…
P. Pawar
  • 23
  • 8
0
votes
2 answers

Mocha async/await test is failing with timeout

I have a test where I am performing a docker stop operation and checking something and starting the docker container. I am using dockerode library. When I run that I test I keep getting the following error - Error: Timeout of 120000ms exceeded. For…
chan
  • 274
  • 1
  • 5
  • 24
0
votes
1 answer

Docker: COPY failed: file not found in build context or excluded by .dockerignore: stat go.mod

What I am trying to do: To build a docker image from inside Go/node routine My docker file is: FROM golang:1.18 WORKDIR /usr/src/app COPY go.mod go.sum ./ RUN go mod download && go mod verify COPY . . RUN go build -v -o /usr/local/bin/app…
nihal
  • 357
  • 1
  • 3
  • 18
0
votes
1 answer

Dockerode not opening two ports

When I attempt to have a second port in the create options, it correctly creates the first, but not the second port. "createOptions": { "Env": [ "DATA_DIR=/tmp/localstack/data", "DOCKER_HOST=unix:///var/run/docker.sock", …
WallMobile
  • 1,939
  • 1
  • 20
  • 35
0
votes
1 answer

How to bind using docker http API

Update I Think I need to use the .run instead of .createContainer I got the command to work without a mount however im not sure how to bind docker container to my cwd docker.run("wpscanteam/wpscan", [ // "--mount", //…
ThatPurpleGuy
  • 426
  • 7
  • 20
0
votes
1 answer

Dockerode - custom folder for container

Since yesterday, I have been trying to make a separate folder for each container in the "folder" folder in node.js api using the docker Library called "dockerode". Unfortunately, I did not find any good solution that would work. I looked at the…
Domi
  • 3
  • 2
0
votes
1 answer

How to mimic 'docker service ps' on a multi host swarm using dockerode or docker api?

I'm trying to use dockerode to access the Docker API. My goal is to get container data for all containers in the multi node swarm. It appears that docker.listContainers( {all: true } ) is scoped to only returns containers running on the calling…
Jack Murphy
  • 2,952
  • 1
  • 30
  • 49
0
votes
0 answers

Can Mocha execute tests without test file?

I am using Mocha framework to run tests with chai assertions. I have a bit unusual architecture for it tho. I have Node.js server where I am using dockerode npm package to dynamically create docker containers upon server receiving POST request to…