Docker容器之间共享的卷

时间:2020-05-09 17:04:48

标签: docker docker-networking docker-network docker-api

我正在尝试使用docker api v1.24从另一个容器创建一个容器。

通过使用以下代码,我设法创建并启动了容器:

exec(`curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d \'{"Image": "strategy_baseline", "Hostname": "test","ExposedPorts": {"${PORT}/tcp": {"HostPort": "${PORT}"}}, "HostConfig": {"Binds": ["/usr/src/app/strategies/${BOT_ID}.js:/usr/src/app/strategies/${BOT_ID}.js"], "NetworkMode": "titan_backend"}, "PortBindings": { "${PORT}/tcp": [{ "HostPort": "${PORT}" }] }, "Env": ["BOTNAME=${BOT_ID}","PORT=${PORT}"], "Cmd": ["yarn", "start"]}\' -X POST http:/v1.24/containers/create?name=${BOT_ID}`

但是它没有正确绑定卷

"Binds": ["/usr/src/app/strategies/${BOT_ID}.js:/usr/src/app/strategies/${BOT_ID}.js"]

任何想法如何通过docker 1.24 api正确绑定卷

0 个答案:

没有答案