Dockerode: Use --rm option for run(..)

Created on 29 Nov 2016  路  3Comments  路  Source: apocas/dockerode

How can I do the equivalent of docker run --rm with dockerode.run(...) ?

I did not find any mentioning of automatic removal in the Docker remote API documentation, but I'm happy to be told what I missed!

question

Most helpful comment

Are you sure?

I'm using it with success, according to the doc:
https://docs.docker.com/engine/api/v1.26/#operation/ContainerCreate

Look the AutoRemove option.

Here a sample i'm using:

docker.run('MyImage', [], process.stdout, {
    Volumes: {[__dirname]: {}},
    HostConfig: {
        Binds: [__dirname + ":/stuff"],
        ShmSize: 1000000000,
        Privileged: true,
        AutoRemove: true
    }
}, {},function (err, data, container) {
    if(err)
        console.log("Error: ", err);
    else
        console.log(data.StatusCode);
});

All 3 comments

I came here to ask the same thing. Did you ever figure this out?

See also: https://github.com/docker/docker-py/issues/870

I don't think this is possible any time soon unless --rm is implemented on the daemon side.

Are you sure?

I'm using it with success, according to the doc:
https://docs.docker.com/engine/api/v1.26/#operation/ContainerCreate

Look the AutoRemove option.

Here a sample i'm using:

docker.run('MyImage', [], process.stdout, {
    Volumes: {[__dirname]: {}},
    HostConfig: {
        Binds: [__dirname + ":/stuff"],
        ShmSize: 1000000000,
        Privileged: true,
        AutoRemove: true
    }
}, {},function (err, data, container) {
    if(err)
        console.log("Error: ", err);
    else
        console.log(data.StatusCode);
});
Was this page helpful?
0 / 5 - 0 ratings