我一直在尝试使我的应用程序正常运行-但我不断收到错误消息:
Task Stop Reason: Essential container in task exited; Container myapp Status Reason: CannotStartContainerError: API error (400): OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"docker-compose up\": executable file not found in $PATH": unknown
我的Dockerfile:
FROM node:9.10.0
COPY / /myapp
WORKDIR /myapp
RUN chown -R node:node /myapp
USER node
RUN mkdir /home/node/.npm-global
ENV PATH=/home/node/.npm-global/bin:$PATH
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
RUN npm install -g @angular/cli
RUN npm install
USER root
ENV USER root
RUN apt-get update && \
apt-get install -y \
python \
python-dev \
python-pip \
python-setuptools \
&& pip install --upgrade awscli \
&& apt-get clean
现在我的任务定义(deploy.yaml
)很简单,其中一部分是:
....
task:
taskRole: "<role>"
containerDefinitions:
- command:
- "docker-compose up"
...
在部署应用程序时,我假设ECS通常运行docker run
,而我需要docker-compose up
来启动我的服务(在docker-compose.yaml
中)。我在哪里运行此命令,或如何修复此路径?
答案 0 :(得分:0)
如果您更接近错误消息:
starting container process caused "exec: \"docker-compose up\": executable file not found in $PATH": unknown
您注意到Docker试图在PATH中找到一个名为“ docker-compose up”的可执行文件。这可能是不正确的,它应该已经找到了一个“ docker-compose”可执行文件(请注意exe路径中缺少“ [space] up”)。 这可能是由错误的“ -command” YML属性引起的。
您应该有类似的东西:
...
-command :
-docker-compose
-up
我在Dockerfile中使用ENTRYPOINT命令遇到了同样的问题:
ENTRYPOINT ["command with parameters"]
无效。你必须有
ENTRYPOINT ["command", "with", "parameters"]