-
-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to specify volumes? #265
Comments
apocas, thanks for replying but I'm afraid that reading the test doesn't make this any clearer for me. the one line that perhaps would be relevant is |
For the next person who hits this on search: Volumes (in this context) are non-copy-on-write directories inside the container. What we want here are 'binds':
|
I still don't get it. From the command line, I can enter a -v argument like this and it works.
...where So, how do I accomplish the exact same thing as above in dockerode? What do I need to specify for |
@wyckster did you manage to figure this out? |
@EdByrnee The confusion was about finding documentation for the schema of the parameter object that is passed to
If I recall correctly the solution is that you don't specify Incidentally, I switched to calling out to docker-compose externally. Sadly I dropped dockerode entirely. :( But Docker-compose is proving to be more useful anyway. |
I can add to this: If you don't need any
This works, at least for now. |
@DonMartin76 I followed your solution but not work now :( By the way, isn't |
For the record, this works for me: {
Image: '…',
name: '…',
Volumes: { '/data': {} },
HostConfig: {
Mounts: [
{
Type: 'volume',
Source: 'my-volume-name',
Target: '/data',
ReadOnly: false,
},
],
},
}; |
Thanks @devkat @DonMartin76 the both work for me, but I finally prefer @devkat proposition because in my case I need to set dynamically the configs for the bind, for example enable readonly or not, set consistency, mount type etc etc. |
the description for the Volumes key of the options passed to
/containers/create
as documented here: https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/ indicates it should receive:"An object mapping mount point paths (strings) inside the container to empty objects."
what? empty objects? what does that mean? I don't see from the source of dockrode how to make the call. if I currently do this in the CLI:
-v ~/db:/data
, would I:Volumes: {'~/db': '/data'}
or...
Volumes: {'~/db': { ...what?... }}
there are no examples for guidance. how do I do this?
The text was updated successfully, but these errors were encountered: