Docker Remote API & Binds

I am trying to use the Docker Remote API through the nodejs docker.io library, but I just cannot find the correct syntax on how to bind directories.

I am currently using this code:

docker.containers.start(cId, { Binds: ['/tmp:/tmp'] }, function(err, container)... 

It starts the container, but when I check it, it does not show anything in the volumes.

The Docker Remote API documentation is missing when it comes to syntax, so I hope someone here knows the correct syntax.

+4
source share
1 answer

Finally, I started to work. It seems you also need to create volumes when creating the container. Here is the correct syntax:

The first API call in / container / create should include:

 { "Volumes": { "/container/path": {} } } 

Then, when starting the container (POST / container // start), use the "Binds" option:

 { "Binds": [ "/host/path:/container/path:rw" ] } 

source: https://groups.google.com/d/msg/docker-club/GrFQ3F1rqU4/3ZC5QoNkSAAJ

+16
source

Source: https://habr.com/ru/post/1496781/


All Articles