I am a new Codenvy user. I am attempting to build a "Stack" in Codenvy that will run postgres.
I am creating my Stack using the following recipe. (Using https://github.com/eclipse/che-dockerfiles/blob/master/recipes/ubuntu_jdk8/Dockerfile as a starting point)
This recipe creates a Codenvy server containing Eclipse Che, Maven, and Tomcat.
I need to add Ant and Postgres to this configuration. I was able to add Ant. My current challenge is adding Postgres to this configuration.
Here is my current recipe.
FROM eclipse/stack-base:ubuntu
EXPOSE 4403 8000 8080 9876 22
LABEL che:server:8080:ref=tomcat8 che:server:8080:protocol=http
che:server:8000:ref=tomcat8-debug che:server:8000:protocol=http
che:server:9876:ref=codeserver che:server:9876:protocol=http
ENV MAVEN_VERSION=3.3.9 \
ANT_VERSION=1.10.1 \
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 \
TOMCAT_HOME=/home/user/tomcat8 \
TERM=xterm
ENV M2_HOME=/home/user/apache-maven-$MAVEN_VERSION
ENV ANT_HOME=/home/user/ant-$ANT_VERSION
ENV PATH=$JAVA_HOME/bin:$M2_HOME/bin:$ANT_HOME/bin:$PATH
RUN mkdir /home/user/tomcat8 /home/user/apache-maven-$MAVEN_VERSION
$ANT_HOME && \
wget -qO- "https://www.apache.org/dist/ant/binaries/apache-ant-$ANT_VERSION-bin.tar.gz" | tar -zx --strip-components=1 -C $ANT_HOME && \
wget -qO- "http://apache.ip-connect.vn.ua/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz" | tar -zx --strip-components=1 -C /home/user/apache-maven-$MAVEN_VERSION/ && \
wget -qO- "http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.24/bin/apache-tomcat-8.0.24.tar.gz" | tar -zx --strip-components=1 -C /home/user/tomcat8 && \
rm -rf /home/user/tomcat8/webapps/* && \
echo "export MAVEN_OPTS=\$JAVA_OPTS" >> /home/user/.bashrc
I found a sample dockerfile that installs postgres with the following command
RUN apt-get update && apt-get install -y ant git postgresql-client postgresql-contrib
When I add this to my Codenvy Stack recipe, I see a failure when I attempt to start my workspace.
[DOCKER] Step 13/13 : RUN apt-get update && apt-get install -y ant git postgresql-client postgresql-contrib
[DOCKER] ---> Running in 672fc2aac027
[DOCKER] Reading package lists...
[DOCKER]
[DOCKER] [91mE: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
[0m
[DOCKER] Removing intermediate container 672fc2aac027
[DOCKER]
[DOCKER] [ERROR] Failed to build image: The command '/bin/sh -c apt-get update && apt-get install -y ant git postgresql-client postgresql-contrib' returned a non-zero code: 100
What is the proper way to install postgres in this environment? Once it is installed, how do I ensure that the postgres service is started?
I resolved this issue with help from codenvy repo on GitHub.
See https://github.com/codenvy/codenvy/issues/2413