I am tyring to run this command in dockerode, I am bit confused on how to run it.
docker run -d -p 1527:80 ajaycs14/hello-world
my code
docker.run('ajaycs14/hello-world', [], process.stdout, {createOptions:{}}, {start_options:["-p 8888:80", "-d"]}, function (err, data, container) {
// ....
});
Container is not started. I am pretty sure something wrong while invoking run , but I couldn't able to figure out.
thank you
Try with
docker.run('ajaycs14/hello-world', [], process.stdout, {PortBindings: { "80/tcp": [{ "HostPort": "8888" }] } }, function (err, data, container) {
// ....
});
The real options are in DockerApi
Edit: If you want to run a container in detach mode:
docker.createContainer({ Image: 'ajaycs14/hello-world', Tty: false, name: 'yourContainerName', PortBindings: { "80/tcp": [{ "HostPort": "8080" }] } }, function (err,container){
container.start();
})
There is an example here
Since it was already correctly tackled, I'm going to close this one. :)
Most helpful comment
Since it was already correctly tackled, I'm going to close this one. :)