Grails 3.1.4 and Docker - grails commands return "No profile found for name web"
<p>I have a simple grails app that runs fine by itself. It does not have a problem using the grails web profile with <code>grails run-app</code></p>

<p>However, when I build a docker image out of the app, the grails commands, such as <code>grails run-app  --stacktrace</code> or <code>grails dependency-report --stacktrace</code> sent to docker fail with stacktrace:</p>

<pre><code>| Error Error occurred running Grails CLI: No profile found for name [web]. (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.IllegalStateException: No profile found for name [web].
    at org.grails.cli.GrailsCli.initializeProfile(GrailsCli.groovy:507)
    at org.grails.cli.GrailsCli.initializeApplication(GrailsCli.groovy:308)
    at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:271)
    at org.grails.cli.GrailsCli.main(GrailsCli.groovy:162)
| Error Error occurred running Grails CLI: No profile found for name [web].
</code></pre>

<p>Docker Build command:
Run from the root of the grails app.
User is in the docker group.</p>

<pre><code>docker build -t mygrailsapp .
</code></pre>

<p>DockerFile:
(Build will fail on RUN grails dependency-report --stacktrace. If I remove that command, the build completes. However, the first time the app is run with default command it fails with same error.)</p>

<pre><code>#
# My Dockerfile
#
# https://github.com/dockerfile/java
# https://github.com/dockerfile/java/tree/master/oracle-java8
# https://hub.docker.com/r/mozart/grails/

# Pull base image. 
FROM ubuntu

RUN apt-get update

# install apt-get-repository
RUN \
    apt-get install -y software-properties-common wget unzip git

# Install Java.
RUN \
  echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections &amp;&amp; \
  add-apt-repository -y ppa:webupd8team/java &amp;&amp; \
  apt-get update &amp;&amp; \
  apt-get install -y oracle-java8-installer
  rm -rf /var/lib/apt/lists/* &amp;&amp; \
  rm -rf /var/cache/oracle-jdk8-installer

# Define working directory.
WORKDIR /data

# Define commonly used JAVA_HOME variable
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle


# Set customizable env vars defaults.
# Set Grails version (default: 3.1.4; min: 3.0.0; max: 3.1.4).
ENV GRAILS_VERSION 3.1.4

# Install Grails
WORKDIR /usr/lib/jvm

# TODO put grails zips on your own server with decent bandwidth
RUN wget https://github.com/grails/grails-core/releases/download/v$GRAILS_VERSION/grails-$GRAILS_VERSION.zip &amp;&amp; \
    unzip grails-$GRAILS_VERSION.zip &amp;&amp; \
    rm -rf grails-$GRAILS_VERSION.zip &amp;&amp; \
    ln -s grails-$GRAILS_VERSION grails

# Setup Grails path.
ENV GRAILS_HOME /usr/lib/jvm/grails
ENV PATH $GRAILS_HOME/bin:$PATH

# Create App Directory
RUN mkdir /app

# Set Workdir
WORKDIR /app

# Copy App files
COPY . /app

# Run Grails dependency-report command to pre-download dependencies but not
# create unnecessary build files or artifacts.
RUN grails dependency-report --stacktrace

# Set Default Behavior
ENTRYPOINT ["grails"]

CMD ["run-app"]
</code></pre>

<p>Setup:</p>

<p>Ubuntu 14.04 LTS 64</p>

<p>Jave: Oracle JDK 1.8.0_77 64</p>

<p>Via sdkman 4.0.32:</p>

<p>Grails 3.14
Groovy 2.4.6
Gradle 2.12</p>

<p>Docker
Client:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 15:54:52 2016
 OS/Arch:      linux/amd64</p>