Bower dependicies with postinstall on Docker

It is possible to install bower dependicies using postinstall in package.json on docker with docker-compose?

package.json file:

  • How to have multiple django requirements file mentioned in fig file for docker deployment across dev, staging and prod servers?
  • How should a container running in network mode bridge communicate with another container running in host mode?
  • Docker vs. Rocket in development
  • Why is mounting the /var/hyperledger/production to the host volume causing an error?
  • Exposing a port on a live Docker container
  • Copy all SBT dependencies to local folder
  •    {
          "name": "mongocrud",
          "version": "0.0.0",
          "private": true,
          "scripts": {
            "start": "node ./config/server.js",
            "postinstall": "node ./node_modules/bower/bin/bower install",
            "test": "mocha"
          "dependencies": {


    FROM node:7.7.2-alpine
    WORKDIR /application
    COPY package.json .
    COPY bower.json .
    COPY .bowerrc .
    RUN npm install -g bower
    RUN npm install
    COPY . .
    EXPOSE 3000
    CMD ["npm", "start"]


    version: '3'
            image: mongo:3.4.4
            command: mongod
            container_name: mongo-container
                - 27017:27017
             build: .
             container_name: express-container
                - 3000:3000
             working_dir: /application
                - mongodb
             command: npm start

    And after use docker-compose up application works fine but missing bower dependicies, can I fix that?


    This I found in console after docker-compose up:

    npm WARN lifecycle mongocrud@0.0.0~postinstall: cannot run in wd %s %s (wd=%s) mongocrud@0.0.0 node ./node_modules/bower/bin/bower install /application


  • How to setup private docker registry securely?
  • Run Docker commands in Jenkins Shell
  • Put docker0 behind NAT
  • Access host machine dns from a docker container
  • Failed to append certificates from PEM in jenkins in docker build and publish plugin OSX
  • Docker container is unable to connect to port opened by another docker container
  • One Solution collect form web for “Bower dependicies with postinstall on Docker”

    Change node ./node_modules/bower/bin/bower install to bower install --allow-root in postinstall script. The --allow-root is to prevent you from permission errors.

    Or you can remove the postinstall script and add RUN bower install --allow-root after RUN npm install in the Dockerfile.

    And bower requires git to work, you have to install git first in your Dockerfile.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.