Quantcast
Channel: Active questions tagged dockerfile - DevOps Stack Exchange
Viewing all articles
Browse latest Browse all 136

How can I enter node commands (like "node -v" or "npm intall xyz --save-dev") in the running docker container?

$
0
0

I'm new to docker.How can I start a node service via docker-compose, which then accepts npm commands?

docker-compose up -d --build   <-- I use this command to start

I want the npm install to be executed and then I can enter e.g. npm mix or npm gulp or node -v or npm install node-sass --save-dev in the container. The package.json should be saved on my local machine (if i use npm install xyz).

my Dockerfile

FROM node:14-alpineWORKDIR /var/www/html COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]RUN npm installCOPY . .EXPOSE 3000

my docker-compose.yml

services:  node:    build: ./    stdin_open: true    tty: true    volumes:       - ./:/app

Viewing all articles
Browse latest Browse all 136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>