How to manage Docker container with dockerode

I'm trying to do a Meteor app to start/stop my Docker containers. I founded dockerode So I have installed it with meteor add ongoworks:dockerode and with meteor npm install dockerode and if I...

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...

Getting stdout and stderr streams from a docker container in Node.js

I am using dockerode library and I want to create a container, execute a (single) command in that and get back (separately) the standard output and standard error of that command. So far I am able...

Node.JS - Promises do not wait to resolve

I am using the dockerode for manipulate docker from node.js. The library it self is not the problem but i am have issues with PROMISE. It seems the promise do not wait to resolve. The code below I...

Passing command args to docker api

I'm attempting to find the equivalent of docker run -it networkstatic/nflow-generator -t localhost -p 9995 when using the docker API (I'm using dockerode, but an answer for the HTTP api is just...

Use a docker sdk to send commands to the docker machine from a web app

I'm new to Docker and I have some difficulties to understand how I should use it. For now, I'm wondering if that makes sense to attempt sending commands to a docker machine on my computer from the...

Why line 27 is executed before line 24?

I m beginner with javascript and try to build a clean object to use the Dockerode library in my use Case. I have an async problem here my line 27 executes before 24 and I don't understand why and...

How to use environment variables in the Cmd arguments of dockerode?

The code below prints out: ??? $VAR I was expecting/hoping for: ??? ttslkfjsdalkfj container.exec( { Cmd: ['echo', 'test $VAR'], Env: ['VAR=ttslkfjsdalkfj'], AttachStdout: true, ...

Best strategies for writing functional test for a node.js program that interacts with mysql database

I have a node.js program which has interactions with a mysql server. Now I'm going to write a functional test using mocha for it. The way I do the functional test is as the following: Create a...

How to add `--health-cmd='mysqladmin ping --silent'` and `--health-interval='1s'` options to dockerode's createContainer() function?

I want to use node.js to manipulate docker containers. And I found a module called dockerode, which seems like the tool I need. However, I haven't found any way to add --health-cmd and...

How do you sync a host and container directory with Dockerode?

How do I sync a folder on my container with a directory on the host so that I can delete the container and make it again with the same data. This is my code so far. let containerMeta = { ...

Execute docker commands through a node js script

Is there any better way to execute docker commands from a node js apart from using shelljs(similar packages) to execute those commands? I have seen the package dockerode. Though it is great for...

After executing following code of dockerode npm getting error "connect EACCES /var/run/docker.sock" on ubuntu 14.04

I am executing following code to get list of all container using npm dockerode on Ubuntu 14.04 machine. Docker container are running properly. var Docker = require('dockerode'); var docker = new...

How to create and connect to a TTY in a docker container from outside the container?

I want the input/output (tty) of a binary debugged in GDB (running in Docker) as a NodeJS stream. GDB can seperate its output and the binary's output by using the tty <tty> command. I want to...

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({ ...

Attach to running container dockerode

Trying to ssh into running container using dockerode. I want to run a container with commands like 'node dist/server.js' then after container is started ssh it into it and run bash by default....

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', ...

How do I both expose the port on a container to the local host AND bind persistent data to the container?

I am using dockerode to create a new PostgreSQL docker container. I want to be able to: Expose port 5432 on the local host Have the container use a directory on the local host as the persistent...

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...

How to directly pass the content of dockerfile as a string to dokerode instead of passing the path of the file

dockerode api needs to be invoked with the following parameters in order to build an image from a dockerfile ex: docker.buildImage({ context: __dirname, src: ['Dockerfile'] }, { t:...

dockerode, how make the process running in container independent from the node process?

I'm working on a small app utilising dockerode for the container management. I'm trying to make the process running in the docker container independent from node process. Essentially what I'm...

Running java code in a docker container using dockerode

I want to send some java code as a string to an API to then run it in a docker container and return the console output, I have managed to do it with Python but as java first needs to be compiled...

Running Docker from a Docker container

Doing a project for my dissertation which involves an angular frontend which talks to a node API backend which needs to use docker to create containers from images run a few lines of code for the...

How do I show a HTTP stream in a Vue.js app

I have a nodejs app that provides a HTTP stream via an endpoint, let's say /api/logs/{id}. Now, I have a frontend web app using Vue.js, and I want to consume that stream endpoint. How do I do that...

pass filePath to dockerfile as variable _ nodeJS dockerode Docker

In my case, I am creating a config.json that I need to copy from the host to my container. I figured out there is some option that I can pass args to my dockerfile. so first step is : 1.create...

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...

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...

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 =...

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...

Windows Host Docker + WSL2 - How to mount Windows directory to a Linux container

I am running Windows 10 as my host, and I am trying to mount a Windows directory into a Linux container (node, Debian based). Previously, I was using Hyper-V backend and the dockerode package to...