[英]Why doesn't the container start?
My docker-compose file is simple: 我的docker-compose文件很简单:
npm:
image: node
volumes:
- C:\Users\Samir\npm\:/home/dev
container_name: npm
When I run it: 当我运行它时:
docker-compose up -d
I get: 我得到:
Starting npm
Then, nothing happens: 然后,什么也没有发生:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Any idea? 任何想法?
Per default the Node image is designed for interactive use and simply starts a Node REPL. 默认情况下,Node映像被设计用于交互使用,并且仅启动 Node REPL。 When you run
docker-compose up -d
the Node REPL will start and exit immediately as no interactive terminal is availabe. 当您运行
docker-compose up -d
,Node REPL将立即启动和退出,因为没有可用的交互式终端。 Try: 尝试:
docker-compose run -it npm
Note that this is currently not supported on Windows, you will need to use docker run -it -v ... node
instead. 请注意,Windows当前不支持此功能,您将需要使用
docker run -it -v ... node
。
If you want to start your application instead simply override the default command in your docker-compose.yml
如果要启动应用程序,则只需覆盖
docker-compose.yml
的默认命令 docker-compose.yml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.