docker run -i -t mysql_Docker Run command with MySQL import

I'm using dockerode for creating and running containers. I'm trying to import data to MySQL. my code:

docker.run('img_cwd',['mysql',

'-h', 'localhost',

'-u', 'user',

`-ppassword`,

'dbName',

'

`/tmp/21336/sql/data/import_file.sql"`],

[process.stdout, process.stderr],

{

Tty: false,

name: nameGenerator.getContainerName(),

AttachStdin: true,

OpenStdin: true,

StdinOnce: true,

HostConfig: {

Binds: ['/C/tmp:/tmp']

}

})

under C:/ tmp I have to folder "21336"

after running my code I see that the import doesn't happen and the docker ps command show this:

15d405443805af1a2635e7bc456311de741352ff4ae6b1efb3d43cb10a73d62c img_cwd "mysql -h localhost -u user-ppassword dbName < /tmp/21336/sql/data/import_file.sql" 9 seconds ago Exited (1) 8 seconds ago Import_b01k8qr29jh868vf0959cy_Data

when I start the container with '-it' flag and run the import command:

mysql -h localhost -u user-ppassword dbName < /tmp/21336/sql/data/import_file.sql

it works perfectly.

the image I use:

FROM alpine:3.9

RUN apk update &&

apk add --no-cache mysql-client

CMD ["/bin/sh"]

the logs for the failed container run shows it does not recognize the command :5OJDd.png

IOyTM.png6nNJb.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值