尝试对 Grails 应用程序进行 dockerization 时出错



我正在尝试使用此docker镜像(https://hub.docker.com/r/mozart/grails/(和以下Dockerfile对这个Grails应用程序(https://github.com/continuumsecurity/RopeyTasks(进行Dockerization:

FROM mozart/grails:2
MAINTAINER Manuel Ortiz Bey <ortiz.manuel@mozartanalytics.com>
# Copy App files
COPY . /app
# Run Grails refresh-dependencies command to 
# pre-download dependencies but not create
# unnecessary build files or artifacts.
RUN grails refresh-dependencies
# Set Default Behavior
ENTRYPOINT ["grails"]
CMD ["run-app"]

但是当我运行命令docker run -it -p 8080:8080 test/grails-app时,我收到以下错误消息:

Sending build context to Docker daemon  170.4MB
Step 1/6 : FROM mozart/grails:2
---> a656bf34ad8e
Step 2/6 : MAINTAINER Manuel Ortiz Bey <ortiz.manuel@mozartanalytics.com>
---> Using cache
---> 194a5f4e84e3
Step 3/6 : COPY . /app
---> Using cache
---> 618a47fd4d06
Step 4/6 : RUN grails refresh-dependencies
---> Running in 74b1b5cd7587
| Loading Grails 2.5.3
| Configuring classpath
| Error Resolve error obtaining dependencies: The following artifacts could not be resolved: org.aspectj:aspectjweaver:jar:1.8.5, cglib:cglib-nodep:jar:2.2.2, org.grails:grails-datastore-test-support:jar:1.0.2-grails-2.4, org.grails.plugins:standalone:zip:9.0.0.M4, org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.8, org.grails.plugins:asset-pipeline:zip:1.9.9, org.grails.plugins:hibernate4:zip:4.3.6.1, org.grails.plugins:database-migration:zip:1.4.0, org.grails.plugins:jquery:zip:1.11.1: Could not transfer artifact org.aspectj:aspectjweaver:jar:1.8.5 from/to grailsCentral (https://repo.grails.org/grails/plugins): Received fatal alert: protocol_version (Use --stacktrace to see the full trace)
| Error Resolve error obtaining dependencies: The following artifacts could not be resolved: org.aspectj:aspectjweaver:jar:1.8.5, org.grails.plugins:standalone:zip:9.0.0.M4, org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.8, org.grails.plugins:asset-pipeline:zip:1.9.9, org.grails.plugins:hibernate4:zip:4.3.6.1, org.grails.plugins:database-migration:zip:1.4.0, org.grails.plugins:jquery:zip:1.11.1: Could not transfer artifact org.aspectj:aspectjweaver:jar:1.8.5 from/to grailsCentral (https://repo.grails.org/grails/plugins): Received fatal alert: protocol_version (Use --stacktrace to see the full trace)
| Error Resolve error obtaining dependencies: The following artifacts could not be resolved: org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.8, org.grails.plugins:asset-pipeline:zip:1.9.9: Could not transfer artifact org.grails.plugins:scaffolding:zip:2.1.2 from/to grailsCentral (https://repo.grails.org/grails/plugins): Received fatal alert: protocol_version (Use --stacktrace to see the full trace)
| Error The following artifacts could not be resolved: org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.8, org.grails.plugins:asset-pipeline:zip:1.9.9: Could not transfer artifact org.grails.plugins:scaffolding:zip:2.1.2 from/to grailsCentral (https://repo.grails.org/grails/plugins): Received fatal alert: protocol_version
| Run 'grails dependency-report' for further information.
The command '/bin/sh -c grails refresh-dependencies' returned a non-zero code: 1

我的码头工人版本是:

# docker version
Client:
Version:           18.06.1-ce
API version:       1.38
Go version:        go1.10.3
Git commit:        e68fc7a
Built:             Tue Aug 21 17:24:58 2018
OS/Arch:           linux/amd64
Experimental:      false
Server:
Engine:
Version:          18.06.1-ce
API version:      1.38 (minimum version 1.12)
Go version:       go1.10.3
Git commit:       e68fc7a
Built:            Tue Aug 21 17:23:24 2018
OS/Arch:          linux/amd64
Experimental:     false

感谢您的帮助!

我遇到了完全相同的问题!找不到绕过它的方法,只能使用来自相同图像 mozart/grails 的基本 Dockerfile,并且以某种方式对我有用。

这是经过一些小修改的 dockerfile:

FROM java:8
# Set Grails version (min: 3.0.0; max: 3.2.8).
ENV GRAILS_VERSION 2.4.5
# Install Grails
WORKDIR /usr/lib/jvm
RUN wget https://github.com/grails/grails-core/releases/download/v$GRAILS_VERSION/grails-$GRAILS_VERSION.zip && 
unzip grails-$GRAILS_VERSION.zip && rm -rf grails-$GRAILS_VERSION.zip && 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
# Copy App files
COPY . /app
# Set Workdir /app and download dependecies
WORKDIR /app
RUN grails refresh-dependencies
# Make port 8080 available to the world outside this container
EXPOSE 8080
# Set Default Behavior
ENTRYPOINT ["grails"]
CMD ["run-app"]

我遇到了同样的问题,请在BuildConfig.groovy中添加此存储库

mavenRepo "http://repository.jboss.com/maven2/"
mavenRepo 'http://repo.spring.io/milestone'
mavenRepo "http://repo.grails.org/grails/core"
mavenRepo "http://repo.grails.org/grails/plugins"

最新更新