html tool

显示标签为“docker”的博文。显示所有博文
显示标签为“docker”的博文。显示所有博文

2020年12月22日星期二

the input device is not a tty docker

 参考:https://stackoverflow.com/questions/43099116/error-the-input-device-is-not-a-tty

问题:

sshpass p '123' ssh root@192.168.100.169 "docker exec -it sht ls -all /root/work/ngtdp/hotfix"|grep hotfix

the input device is not a tty

解决:

Remove the -it from your cli to make it non interactive and remove the TTY. If you don't need either, e.g. running your command inside of a Jenkins or cron script, you should do this.

Or you can change it to -i if you have input piped into the docker command that doesn't come from a TTY. If you have something like xyz | docker ... or docker ... <input in your command line, do this.


[popexizhi:

原始的命令是 

docker exec -it sht /bin/bash

这里的/bin/bash是可以用的其他用的方式替代的

]

2020年12月17日星期四

转:拷贝docker中的文件到本地目录

 https://blog.csdn.net/dongdong9223/article/details/71425077

PS: 需要注意的是,不管容器有没有启动,拷贝命令都会生效

1 从容器拷贝文件到宿主机

拷贝方式为:

docker cp 容器名:容器中要拷贝的文件名及其路径 要拷贝到宿主机里面对应的路径

例如,将容器:

mycontainer

中路径:

/opt/testnew/

下的文件:

file.txt

拷贝到宿主机:

/opt/test/

路径下,在宿主机中执行命令如下:

docker cp mycontainer:/opt/testnew/file.txt /opt/test/