我正在尝试使用此docker映像(https://github.com/continuumsecurity/RopeyTasks)和以下Dockerfile对该Grails应用程序(https://hub.docker.com/r/mozart/grails/)进行Docker化:
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版本是:
# 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
感谢您的帮助!
答案 0 :(得分:1)
我遇到了完全相同的问题!无法找到解决方法,只能使用来自同一映像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"]
答案 1 :(得分:0)
我遇到了同样的问题,在 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"