我想对我的vueJs应用程序进行docker化。在本地计算机上,我可以通过运行命令 npm intall 和 npm run serve 在本地主机上安装并提供服务强>。
我想创建一个docker镜像,所以我写了一个dockerfile。我的dockerfile看起来像这样
FROM Image_Name
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["npm", "serve"]
但是我无法使用docker run命令运行我的docker映像。任何想法,我做错了。
运行run命令后-
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
npm@6.2.0 /usr/lib/node_modules/npm
答案 0 :(得分:0)
当您尝试执行时
npm run serve
你应该把
CMD ["npm", "run", "serve"]
在您的Dockerfile中。
您缺少run
部分。