Hi all
I'm trying to use Dockerode via docker.run() and I want to share (or copy) a directory from the host machine with the container but am not having any luck. Is anyone able to help please?
I have tried to check examples, tests and source code but have not found anything which works, using e.g.:
let createOptions =
{
Tty: false,
// [host-src:]container-dest[:<options>]
Volumes:
{
"/Users/neil/Desktop/": {}
},
'Binds': ['/Users/neil/Desktop/:/stuff']
};
Does result in a /Users/neil/Desktop directory being created on the container but no files are copied in. I am probably missing something really silly but I can't work out what.
Any help would be hugely appreciated!
Cheers
Neil
Ah sorry, I had a separate issue which kept the working part from doing it's thing. So...for anyone who needs to mount a host directory on a container via Dockerode, you can use the following create_options:
let createOptions =
{
Tty: false,
'Binds': ['/host/dir/path/:/container/dir/path/']
};
This is when you're using docker.run() something like this:
docker.run(image, cmds, [stdOutStream, stdErrStream], createOptions, function (err, data, container)
{
// ...
});
Hope that saves someone some time.
Cheers
Most helpful comment
Ah sorry, I had a separate issue which kept the working part from doing it's thing. So...for anyone who needs to mount a host directory on a container via Dockerode, you can use the following create_options:
This is when you're using
docker.run()something like this:Hope that saves someone some time.
Cheers