Zeno
Zeno

Reputation: 591

Problems creating OpenShift app using Dockerfile (with oc new-app)

I am trying to create an OpenShift application from an Express Node js app, using a Dockerfile. The web app is currently a skeleton created with express generator and the Dockerfile looks like this:

FROM node:boron

# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Install app dependencies
COPY package.json /usr/src/app/
RUN npm install

# Bundle app source
COPY . /usr/src/app

EXPOSE 3000
CMD [ "npm", "start" ]

I am running the OpenShift Online version 3, using the oc CLI.

But when I run:

oc new-app c:\dev\myapp --strategy=docker 

I get the following error message:

error: buildconfigs "node" is forbidden: build strategy Docker is not allowed

I have not found a way to enable Docker as build strategy. Why do I get this error message and how could it be resolved?

Upvotes: 1

Views: 1310

Answers (1)

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

OpenShift Online does not allow you to build images from a Dockerfile in the OpenShift cluster itself. This is because that requires extra privileges which at this time are not safe to enable in a multi user cluster.

You would be better off using the NodeJS S2I builder. It can pull in your source code for your repo and will build an image for you without needing a Dockerfile.

Read this blog post to get started:

Upvotes: 3

Related Questions