Reputation: 3692
I'm deploying an application to a pre-configured GlassFish Docker container on Elastic Beanstalk. I need to install the MySQL connector/J library so it's accessible to GlassFish. According to the AWS documentation, "With preconfigured Docker platforms you cannot use a configuration file to customize and configure the software that your application depends on." But it does state: "you can add a Dockerfile to your application's root folder."
They provide an example (with no explanation!) on installing a PostgreSQL library for Python but I'm using Java and MySQL. As I am completely unfamiliar with Docker (and really just need to configure this one thing), I can't figure out how to do it. Using Amazon's example Dockerfile I was able to come up with this:
FROM amazon/aws-eb-glassfish:4.1-jdk8-onbuild-3.5.1
# Exposes port 8080
EXPOSE 8080 3306
# Install MySQL dependencies
RUN curl -L -o /tmp/mysql-connector-java-5.1.34.jar https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar && \
apt-get update && \
apt-get install -y /tmp/mysql-connector-java-5.1.34.jar libpq-dev && \
rm -rf /var/lib/apt/lists/*
However, on application deploy, I'm getting the following error:
t update && apt-get install -y /tmp/mysql-connector-java-5.1.34.jar libpq-dev && rm -rf /var/lib/apt/lists/*] returned a non-zero code: 100"
And obviously, my library is not installed. How can I install the MySQL Connector/J library with a Dockerfile?
Upvotes: 2
Views: 8467
Reputation: 24483
apt-get install -y /tmp/mysql-connector-java-5.1.34.jar
This is not how apt-get
works. It installs debian packages.
There is a package called libmysql-java
that may be what you want.
You might also try something like
RUN curl -L -o /mysql-connector-java-5.1.34.jar https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar
ENV CLASSPATH=/mysql-connector-java-5.1.34.jar:${CLASSPATH}
Upvotes: 2