Giter VIP home page Giter VIP logo

Comments (7)

vweevers avatar vweevers commented on May 29, 2024 1

and yes my process is running in the vm

That's the problem, I think. Until that process exits (or is detached), the docker-machine ssh .. process on the host machine won't exit, and hence, your callback in JS land is not called.

from node-docker-machine.

vweevers avatar vweevers commented on May 29, 2024 1

Would be a cool feature though (attaching to long-running processes). Usage could look something like this (thinking out loud):

const vm1 = new Machine({ name: "vm1" });
const cp = vm1.ssh("docker run user/image", { stdio: 'pipe' });

// Do whatever you want with the child process
cp.stdout.pipe(..)

from node-docker-machine.

vweevers avatar vweevers commented on May 29, 2024

This is not a whole lot to go on. Is it stderr output, by chance?

from node-docker-machine.

pierremzz avatar pierremzz commented on May 29, 2024

It is not stderr, my callback is never triggered. But when I intentionally pass a wrong image name it triggers the callback correctly with a docker error like Unable to find image ....

from node-docker-machine.

vweevers avatar vweevers commented on May 29, 2024

What is the CMD and/or ENTRYPOINT of the image? Does that process exit?

from node-docker-machine.

pierremzz avatar pierremzz commented on May 29, 2024

Dockerfile:

FROM node:carbon

WORKDIR /app

ADD ./app /app

RUN npm install

EXPOSE 7070

CMD ["node", "index.js"]

My project folder is like:

.
├── app
│   └── index.js
├── Dockerfile
├── package.json
├── package-lock.json
├── remoteAddresses.txt
└── test
    └── docker-machine.js

sudo docker inspect lockra/test1 output:

[
    {
        "Id": "sha256:824eef4b4eaeae6de3f5c310c2284cf0488f600b7fa410c2a216f3029d984f14",
        "RepoTags": [
            "test1:latest",
            "lockra/test1:latest"
        ],
        "RepoDigests": [
            "lockra/test1@sha256:9f1e05a0d395296ea9a250034db10754090698b49cd7aaa17d76eb0f865218f6"
        ],
        "Parent": "sha256:67d0b17d7bf6d3a324d8b5656665c6ccfabf034049f6d0909c76f12490a35223",
        "Comment": "",
        "Created": "2018-03-01T12:20:40.669863964Z",
        "Container": "378defebd75528eb751513ae96a4f15247259cd04551b494b0edc428011c54ea",
        "ContainerConfig": {
            "Hostname": "378defebd755",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "7070/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "NODE_VERSION=8.9.4",
                "YARN_VERSION=1.3.2"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "#(nop) ",
                "CMD [\"node\" \"index.js\"]"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:67d0b17d7bf6d3a324d8b5656665c6ccfabf034049f6d0909c76f12490a35223",
            "Volumes": null,
            "WorkingDir": "/app",
            "Entrypoint": null,
            "OnBuild": [],
            "Labels": {}
        },
        "DockerVersion": "17.12.0-ce",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "7070/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "NODE_VERSION=8.9.4",
                "YARN_VERSION=1.3.2"
            ],
            "Cmd": [
                "node",
                "index.js"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:67d0b17d7bf6d3a324d8b5656665c6ccfabf034049f6d0909c76f12490a35223",
            "Volumes": null,
            "WorkingDir": "/app",
            "Entrypoint": null,
            "OnBuild": [],
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 679598745,
        "VirtualSize": 679598745,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/57503ffd248e29e04fc809f389631c5a714576c54a2a3f4d1b55d05167569536/diff:/var/lib/docker/overlay2/faea56faed7ec0a0c6e117dbd0a574a66b1018439e1a9810afc6847a72188577/diff:/var/lib/docker/overlay2/e4c3fe1fbe46a3156b3ae9b3718855085209698b10b648881bc6913fd5946dd5/diff:/var/lib/docker/overlay2/1366c78564b9cc8e3911920eddad14b84da830d144c2ae22145ba08aab61d21c/diff:/var/lib/docker/overlay2/3edf27a185846b7ffebabdd145874f6874b372805896c6cb72aeca931350b48c/diff:/var/lib/docker/overlay2/0e6aafacadde93e1a664bdb003d929abdbb64a5b8bc060805c265eb55612d66b/diff:/var/lib/docker/overlay2/7635b4d9437e7af79fa2cf43400a0de39dcda9007ea21ab2d4898a57bad921c4/diff:/var/lib/docker/overlay2/e9d23912c9c49b09ab2ada105ceb1dd772d5f59932e279490b554d1584433040/diff:/var/lib/docker/overlay2/165934e650a5ca717b25a08f3d9c5ee9a91758c43e056f0880afe463593a40ef/diff:/var/lib/docker/overlay2/a88b70e566e3c251c77c220f24d5276d47bb2e62fa7dce60811ab322ed1493ae/diff",
                "MergedDir": "/var/lib/docker/overlay2/2365259f835d272cc0864b403438c78c68c04d9bbbc747585cc2a35b01e97710/merged",
                "UpperDir": "/var/lib/docker/overlay2/2365259f835d272cc0864b403438c78c68c04d9bbbc747585cc2a35b01e97710/diff",
                "WorkDir": "/var/lib/docker/overlay2/2365259f835d272cc0864b403438c78c68c04d9bbbc747585cc2a35b01e97710/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:ffc4c11463ee21b7532b63abd6079393c619a5d0f4b00397a4b9d1cf9efc4d9b",
                "sha256:5c33df241050ae4cb09e35593a0f846a7a3850b5d16c7d5c62ee82f9cec496f0",
                "sha256:d6335a641f5e226dd553431c7d743927208e5b4eb311bedf0fe48a5edb5a1db1",
                "sha256:6b60013e5875aaca9b2a6bf81bcada496d96b46b0b498291830c076f40f7042a",
                "sha256:daa6e91e491c82f93405eb131ca8e83d85128c051c6ee1901c0d198cd637244b",
                "sha256:066828d986f0c323c682197cd402794757acbf9f9d6c1035e2cc79ec29dfa622",
                "sha256:227d94b074c000d93f673ea75393f6943832a4c5642d6f18a440cc48160f38cc",
                "sha256:eb84ae861586b11c36a59f8914c5656fd4e975f9c3261cca400fd9d2c7bd7d51",
                "sha256:f45597e226c8646e750e379297c3b865ffb8e5057a60d7b9b58d99919e68b54b",
                "sha256:99c24dce884b732ac8681ea0b43844ca89ee6ead63ac6fd8ad357e99d5f3baa8",
                "sha256:9825725347afb21de61c0ff8b125c201f814cae539e717ee80795282421afb57"
            ]
        },
        "Metadata": {
            "LastTagTime": "2018-03-02T12:56:31.243477083+01:00"
        }
    }
]

from node-docker-machine.

pierremzz avatar pierremzz commented on May 29, 2024

and yes my process is running in the vm :

docker@vm-rig1:~$ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
6afad48010a5        lockra/test1        "node index.js"     57 seconds ago      Up 56 seconds       7070/tcp            sharp_goldwasser
3d94c4edea24        lockra/test1        "node index.js"     45 minutes ago      Up 45 minutes       7070/tcp            brave_pike
538157320c1f        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            gifted_ritchie
076b99a9f29c        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            brave_brahmagupta
9dc007ee3643        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            dazzling_johnson
ed18e74d7bdf        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            hungry_brahmagupta
e08673edc103        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            jolly_bartik
07eadcc0b623        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            romantic_einstein
bc380c4d9997        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            nervous_jang
232a8dedfe2b        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            adoring_wescoff
b64ffac6d710        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            tender_benz
f3ea84c1e60f        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            cocky_yalow
900dfd9c2be0        lockra/test1        "node index.js"     About an hour ago   Up About an hour    7070/tcp            compassionate_chandrasekhar
8cee48df1a11        lockra/test1        "node index.js"     2 hours ago         Up 2 hours          7070/tcp            keen_mclean
c334da0d7d7e        lockra/test1        "node index.js"     2 hours ago         Up 2 hours          7070/tcp            compassionate_goldberg
d24f71a4c49d        lockra/test1        "node index.js"     2 hours ago         Up 2 hours          7070/tcp            loving_bhabha
bc9d21b995ef        lockra/test1        "node index.js"     2 hours ago         Up 2 hours          7070/tcp            tender_dijkstra
34d3174f1475        lockra/test1        "node index.js"     2 hours ago         Up 2 hours          7070/tcp            epic_goldberg
a5a451dec0ef        lockra/test1        "node index.js"     2 hours ago         Up 2 hours          7070/tcp            jovial_rosalind
abd2b5fcd337        lockra/test1        "node index.js"     2 hours ago         Up 2 hours          7070/tcp            angry_agnesi
97978d547358        lockra/test1        "node index.js"     2 hours ago         Up 2 hours          7070/tcp            keen_clarke
29a54ba21fcf        lockra/test1        "node index.js"     2 hours ago         Up 2 hours          7070/tcp            awesome_mcnulty

from node-docker-machine.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.