Reputation: 493
I want to dockerize my vueJs application. On my local machine I am able to install and serve my application on localhost by running command npm install and npm run serve.
I want to create a docker image so I wrote a dockerfile. My dockerfile looks like this
FROM Image_Name
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["npm", "serve"]
But I am not able to run my docker image with docker run command. Any idea what I am doing wrong.
After running the run command-
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
Upvotes: 1
Views: 2654
Reputation: 968
When you are trying to execute
npm run serve
you should put
CMD ["npm", "run", "serve"]
in your Dockerfile.
You are missing the run
part.
Upvotes: 1