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!
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);
});
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
AutoRemoveoption.Here a sample i'm using: