简体   繁体   中英

docker npm install serve fails

I'm not very familiar to docker, but I'm trying to put the frontend (written with create-react-app) into the docker container. I've found a tutorial and followed it, so my Dockerfile looks like this:

FROM node:7.8.0

ENV NPM_CONFIG_LOGLEVEL warn

RUN npm install -g serve
CMD serve -s --port 8081 build
EXPOSE 8081

COPY package.json package.json
COPY npm-shrinkwrap.json npm-shrinkwrap.json
RUN npm install

COPY . .

RUN npm run build --production

In my machine it works ok, but when I try to put it on server (raspberry pi) with docker-compose it fails.

Step 3 : RUN npm install -g serve
ERROR: Service 'frontend' failed to build: rpc error: code = 2 desc = "oci runtime error: exec format error"

I've googled, but haven't found exactly this problem. I even tried to put sudo before npm install, but got an error

/bin/sh: 1: sudo: not found

您可以在本地创建私有存储库,也可以将其推送到docker-hub,然后尝试将其加载到raspberry-pi上。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM