启动容器会导致错误
我想dockerize我的Angular应用程序,但是,我有一个容器中运行它的问题。
这是我的Dockerfile:
FROM node:8.6-alpine RUN mkdir /app WORKDIR /app COPY package.json ./ COPY .angular-cli.json ./ COPY tsconfig.json ./ COPY tslint.json ./ COPY src/ ./src/ RUN yarn install && yarn global add @angular/cli EXPOSE 4200 ENTRYPOINT ["./node_modules/angular-cli/bin/ng serve --host 0.0.0.0 --port 4200"]
这里是我的命令如何运行它:
$ docker run -p 4200:4200 my-notes
和我在启动我的容器时在控制台中的错误:
container_linux.go:262: starting container process caused "exec: \"./node_modules/angular-cli/bin/ng serve --host 0.0.0.0 --port 4200\": stat ./node_modules/angular-cli/bin/ng serve --host 0.0.0.0 --port 4200: no such file or directory" docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"./node_modules/angular-cli/bin/ng serve --host 0.0.0.0 --port 4200\": stat ./node_modules/angular-cli/bin/ng serve --host 0.0.0.0 --port 4200: no such file or directory". ERRO[0000] error waiting for container: context canceled
我尝试设置ENTRYPOINT
只是ng serve
,然后容器工作,没有错误logging在控制台,但我无法从我的浏览器运行应用程序(页面不可用)
ENTRYPOINT
命令接受参数列表。 您只放置了一个包含命令和参数的参数。
我build议你把你的ENTRYPOINT
replace成这样的东西 – 分开参数
ENTRYPOINT ["./node_modules/angular-cli/bin/ng", "serve", "--host", "0.0.0.0", "--port", "4200"]
从你发布的“没有这样的文件”的错误,我猜"./node_modules/angular-cli/bin/ng serve --host 0.0.0.0 --port 4200"
正在试图find一个叫"./node_modules/angular-cli/bin/ng serve --host 0.0.0.0 --port 4200"
,显然不存在:)当你删除其他参数,docker能够find该文件。
- 如何编写一个bash脚本来使用docker-machine自动设置ufw规则?
- Jenkins for Scala(SBT)Git master => Build => Test => Build Docker =>推入hub.docker
- 需要使用Azure容器registry将angular度种子高级项目部署到Azure应用程序服务
- Gitlab runner:可以运行一个依赖于另一个的docker镜像
- callback(或相当于)容器瓦特/ Rails应用程序完成启动时?
- Dockerized Angular 4和Django编译成功,但localhost:4200不能正常工作
- 在Docker镜像中的构build错误
- 你如何使用Docker在Windows上设置selenium网格?
- Docker中的量angular器testing – asynchronouscallback没有在由jasmine.DEFAULT_TIMEOUT_INTERVAL指定的超时
- 我无法使用基本url访问dockerizedangular应用程序
- 如何解决Dokku部署中的预接收钩拒绝错误?