我想将我的vueJs应用程序停靠。在我的本地机器上,我可以通过运行命令npm intall和npm run serve在localhost上安装和提供我的应用程序。
我想创建一个docker镜像,所以我写了一个dockerfile。我的dockerfile看起来像这样
FROM Image_Name
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["npm", "serve"]
但是我无法用docker run命令运行我的docker镜像。知道我哪里做错了。
运行运行命令后 -
Usage: npm <command>
where <command> is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
completion, config, create, ddp, dedupe, deprecate,
dist-tag, docs, doctor, edit, explore, get, help,
help-search, hook, i, init, install, install-test, it, link,
list, ln, login, logout, ls, outdated, owner, pack, ping,
prefix, profile, prune, publish, rb, rebuild, repo, restart,
root, run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami
npm <command> -h quick help on <command>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
/root/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
[email protected] /usr/lib/node_modules/npm
当您尝试执行npm run serve
时,您应该将CMD ["npm", "run", "serve"]
放入Dockerfile中。你错过了run
部分。