我可以在本地容器上成功运行以下镜像。
Dockerfile:
FROM ubuntu:latest
RUN apt-get update
RUN apt-get -qq update
RUN apt-get install -y nodejs npm
# TODO could uninstall some build dependencies
# debian installs `node` as `nodejs`
RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
COPY package.json package.json
RUN npm install
COPY . .
CMD ["npm", "start"]当前文件夹包含一个简单的"hello world“node-express应用程序,我可以将其卷曲到localhost:3000。
depolyment.yml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: node-deployment
labels:
app: node-app
spec:
replicas: 2
selector:
matchLabels:
app: node-app
template:
metadata:
labels:
app: node-app
spec:
containers:
- name: node-app
image: my-repo/ubuntu-node:firsttry
ports:
- containerPort: 3000和事件(kubectl describe pod):
Warning BackOff 40s (x20 over 5m) kubelet, minikube Back-off restarting failed container对如何解决这个问题有什么建议吗?
发布于 2018-04-11 20:16:48
好的,这个吊舱被创建了,然后一次又一次地崩溃。我通过运行以下命令发现这一点:
kubctl logs node-deployment-57568f8f75-c2brt
这是一个节点问题:
[nodemon] watching: *.*
[nodemon] starting `node app.js`
Example app listening on port 3000!
[nodemon] Internal watch failed: watch /usr/lib/x86_64-linux-gnu/libanl.a ENOSPC现在,我只需将Dockerfile文件中的CMD更改为:
CMD ["node", "app.js"]现在,pods正在运行。
https://stackoverflow.com/questions/49773157
复制相似问题