我是Docker技术的新手,我正在尝试创建一个用于设置docker容器的shell脚本,我的脚本文件如下所示
#!bin/bash
docker run -t -i -p 5902:5902 --name "mycontainer" --privileged myImage:new /bin/bash
Run Code Online (Sandbox Code Playgroud)
运行此脚本文件将在新调用的bash中运行容器.
现在我需要运行一个脚本文件(test.sh),该文件已经在上面给出的shell脚本的容器内了.(例如:cd /path/to/test.sh&& ./test.sh)如何做到这一点,请随便问一下情景是否不清楚.
在CI过程中登录时出现此错误:
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Run Code Online (Sandbox Code Playgroud)
我应该用"--password-stdin"代替"--password"吗?
我在网上搜索了这个问题并登陆了服务器故障:
我可以将一些文本发送到在屏幕会话中运行的活动进程的STDIN吗?
看起来在Linux下实现这一目标非常容易.但我需要它为Win32命令提示符.
背景:我有一个轮询STDIN的应用程序,如果按下该x键,应用程序将终止.现在,我想做一些自动化测试,测试应用程序然后关闭它.
注意:由于我正在调查在关闭应用程序期间出现的问题,因此不能选择终止进程.
这不适用于二进制文件:Redirecting standard input\output in Windows Powershell
以下是我用于输入的内容的摘要。您可以看到 ls 显示文件大小为 858320 字节,但是当通过 Get-Content 进行管道传输时,情况并非如此。
PS C:\Users\Joseph\Documents\GitHub\java_hprof_to_txt> ls .\generate_hprof\heap.dump.hprof
Directory: C:\Users\Joseph\Documents\GitHub\java_hprof_to_txt\generate_hprof
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 1/28/2017 12:02 PM 858320 heap.dump.hprof
Run Code Online (Sandbox Code Playgroud)
这是我的最小测试程序,它计算标准输入中的字节数,直到达到 eof:
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
int main()
{
char buff;
int numOfBytesRead;
int dataLen = 0;
#ifdef _WIN32
int result = _setmode(_fileno(stdin), _O_BINARY);
if (result == -1)
perror("Cannot set mode");
else
printf("'stdin' successfully changed to binary mode\n");
#endif
while (true) {
numOfBytesRead = …Run Code Online (Sandbox Code Playgroud) docker ×2
powershell ×2
bash ×1
batch-file ×1
console ×1
dockerfile ×1
process ×1
shell ×1
windows ×1