Kev*_*ski 3 command-line containers volumes docker
这种情况发生在多个命令变体中.
基本上......
首先我运行容器:docker run -it --publish 8080:8080 --name app_in_docker node:latest
然后我在几秒钟之后在下一行中得到这个响应:
>
这使得看起来我在容器中,即使命令行通常看起来像:
root@bcb5705c09c1:/#当我在容器中时.我输入的任何内容都>表明了这一点:
ReferenceError: <command> is not defined
at repl:1:1
at ContextifyScript.Script.runInThisContext (vm.js:44:33)
at REPLServer.defaultEval (repl.js:239:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:440:10)
at emitOne (events.js:120:20)
at REPLServer.emit (events.js:210:7)
at REPLServer.Interface._onLine (readline.js:279:10)
at REPLServer.Interface._line (readline.js:626:8)
Run Code Online (Sandbox Code Playgroud)
我已经使用了诸如ls,cd,exit,help, - help,WORKDIR,docker,error等命令而没有任何成功,我收到相同的消息.
然后我关闭docker quickstart终端(我正在使用windows和virtualbox在后台运行)并重新打开终端.我现在可以使用以下docker exec -it <container_name/id> bash命令进入容器:
命令行现在看起来应该如下:root@bcb5705c09c1:/#
第二个与半相关的问题,如果你能提供帮助!如何在计算机中指定音量路径?我没有成功地合并卷如此:docker run -it -v /c/app:/usr/src/app --publish 8080:8080 --name app_in_docker node:latest尝试连接到C:\ app文件夹中的文件.可能是因为我在Windows上运行虚拟机?
感谢您的任何帮助!
根本不是节点人,但是如果你看看node:latest Dockerfile,你会看到CMD执行的默认值是"node".所以我猜你会被放到某种Node REPL中,那些shell命令不起作用.这也是为什么exec ... bash工作,你在bash,而不是node.
如果您第一次想要这种行为,只需将命令放在命令bash的末尾,docker run ...它将覆盖Dockerfile中定义的默认值.
第二个问题,是的,可能是因为你在Windows上运行Virtualbox.它只是一个常规设置?或Docker-Machine(为您安装一些主机文件夹)或Docker for Windows(这是一个不同的鱼群).
| 归档时间: |
|
| 查看次数: |
1283 次 |
| 最近记录: |