Doing AEM Quick Install once when building a docker image - docker

I have this docker file:
FROM flurdy/oracle-java7
COPY aem-quickstart-5.6.1.jar /aem-quickstart-5.6.1.jar
COPY license.properties /license.properties
RUN java -jar /aem-quickstart-5.6.1.jar -unpack
EXPOSE 4502 4502
ENTRYPOINT ["/crx-quickstart/bin/quickstart"]
My intention was to have AEM do all it's startup work with this line:
RUN java -jar /aem-quickstart-5.6.1.jar -unpack
By that I mean all the unpacking and installing of the AEM bundles. But all that line does is extract some start/stop scripts.
How can I tell AEM quick start to install all bundles and then shutdown, so I can do that work once at image build time, and have a quick startup time when the image is run.

instead of unpack run aem normally, you can pass a listener-port argument to the startup command and monitor progress, when startup is complete - issue a shutdown.
here is a python based implementation - https://github.com/awadheshv/aem_6-1_docker/blob/master/base/aemInstaller.py

Related

How do I run a script file in Windows?

I am trying to build Pyodide from source on Windows. In their documentation they recommend using Docker. From the documentation:
1 Install Docker
2 From a git checkout of Pyodide, run ./run_docker or ./run_docker --pre-built
3 Run make to build.
I don't understand how to run ./run_docker?
I don't even know exactly what the file is. Is it a shell script?
Combining your question, "How do I run a script file in Windows?", with the information provided (you want to run a file called run_docker from the Pyodide project) you should get started by installing the Windows Subsystem for Linux version 2 (WSL). After you install WSL, you will need to open a command prompt, run bash to enter the Ubuntu linux distribution. From here you should follow the steps for building on Linux. When you run into a problem you can search the internet for solutions related to "Linux" or "Ubuntu".

Cant load CSS with Docker installation on Superset

I installed superset following these steps using Docker but when I go to http://localhost:8088/superset there is no CSS. Furthermore, every time I try to create a chart I get sent back to the main page. Like, if I hit http://localhost:8088/chart/add I get the same static interface of http://localhost:8088/superset
I am trying to install on a MacBookPro 2018.
Link to installation steps I followed
https://github.com/apache/incubator-superset/blob/master/docs/installation.rst#user-content-start-with-docker
Code I used
git clone https://github.com/apache/incubator-superset/
cd incubator-superset/contrib/docker
docker-compose run --rm superset ./docker-init.sh
docker-compose up
I installed Apache Superset, docker version and I faced the similar issue. When I logged into the superset container by running docker exec I found that webpack.js was taking time to compile source. Once done it loaded perfectly.
Sometimes it takes time to build the superset_node package, which is responsible for compiling the UI components. In order to force-build them without waiting,
docker-compose down
docker-compose build
docker-compose up

Apache PredictionIO - Docker run failed

I have been trying http://predictionio.apache.org/install/install-docker/ this tutorial. I have successfully built Docker image however when I try to run docker run i get the Can't open /etc/predictionio/pio-env.sh error.
docker build -t predictionio/pio pio
docker run -ti predictionio/pio
PS: If I comment out the last line CMD ["sh", "/usr/bin/pio_run"] I can build and run docker image successfully. I can open the file too from docker bash.
I think you need to grant permissions to execute this file. add the following line at the end of your Dockerfile
RUN chmod +x pio_run.sh
also, you might need to change CMD to ENTRYPOINT like following:
ENTRYPOINT ["sh","/usr/bin/pio_run.sh"]
Your output states you are running Windows. Did you use the default command prompt or did you use docker terminal? I had the same error messages in the past on Windows but mysteriously it disappeared after trying the tutorial again. I am not sure what I did different except I might possibly used docker instead of the default command prompt...
Could you also try using docker-compose instead of plain docker commands as described in the tutorial?
Ensure your storage (Postgres, MySQL or ElasticSearch) is running before starting PIO as well.
Just resolved it on my machine.
When you cloned repository on Windows, git converted end of line symbols from Unix-style (\n) to Windows style (\r\n).
You need to open file C:\wherever-you-cloned-pio-repository\predictionio\docker\pio\pio_run and change it back (for e.g. using Visual Studio Code, or Notepad++). Then you need to rebuild the image and it should work.
Also for the future you may want to disable automatic conversion Disable git EOL Conversions

How to install karaf features using Dockerfile

I am trying to create a Dockerfile that will automatically install apache karaf and configure it to work and its working fine.
I want to install list of features. I can do it with below
docker exec -it 7447419c89da /opt/karaf/bin/client
but I want to automate the process. What command can I run that will allow me to install the features?
You can use XML file (Feature Repository] and copy it into .../apache-karaf-4.1.5/deploy folder. Then it will be picked-up by Karaf during start-time and features described in the file will be installed automatically if they have attribute specified: install="auto".
Sample file:
<features
name="AET Features"
xmlns="http://karaf.apache.org/xmlns/features/v1.3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apache.org/xmlns/features/v1.3.0">
<repository>mvn:org.apache.cxf.karaf/apache-cxf/3.2.0/xml/features</repository>
<feature name="fooo" version="1.0.0" description="Features that should be installed" install="auto">
<feature>cxf-core</feature>
<feature>webconsole</feature>
<bundle>mvn:org.apache.karaf.webconsole/org.apache.karaf.webconsole.features/4.1.2</bundle>
</feature>
</features>
This will install new feature called fooo which consist of cxf-core feature - just for purpose of this example (this one needs its own repository location), the webconsole feature that is available on Karaf and additional bundle that provides a view of features in the Web Console.
To summarise:
Download and unzip Karaf
create a file with some name, i.e.: required-features.xml with features description
Start Karaf instance
You can find examples of feature files in Karaf source, e.g.:
https://github.com/apache/karaf/blob/master/assemblies/features/spring/src/main/feature/feature.xml
TL;DR - pass the features as a parameter to the client as docker exec -it 7447419c89da /opt/karaf/bin/client -r 7 "feature:install http; feature:install webconsole"
I think that the Witek's answer is correct and that is how it should work.
However when I was building my own Dockerfile for iDempiere Micro on Karaf to automatically install Apache Karaf, install other features (e.g. WebConsole) and deploy my bundles, I found out, that the only way how to achive this was:
install Apache Karaf in the Dockerfile, also include other helper shell scripts, do not try to install the features
start the docker with Karaf, let it boot and wait a while (on my testing environment it took up to 120s to be ready)
run /opt/karaf/bin/client as in your question and pass the required features as parameters as in docker exec -i idempiere-micro-karaf /opt/karaf/bin/client -r 7 "feature:install http; feature:install http-whiteboard; feature:install war; feature:install webconsole"
wait again, restart Apache Karaf using docker exec -i idempiere-micro-karaf /opt/karaf/bin/client "system:shutdown -f -r"

Docker hub automated build fails but locally does not

I have setup an automated build on Docker hub here (the sources are here).
The build goes well locally. I have also tried to rebuild it with --no-cache option:
docker build --no-cache .
And the process completes successfully
Successfully built 68b34a5f493a
However, the automated build fails on Docker hub with this error log:
...
Cloning into 'nerdtree'...
[91mVim: Warning: Output is not to a terminal
[0m
[91mVim: Warning: Input is not from a terminal
[0m
[m[m[0m[H[2J[24;1HError detected while processing command line:
E492: Not an editor command: PluginInstall
E492: Not an editor command: GoInstallBinaries
[91mmv: cannot stat `/go/bin/*': No such file or directory
[0m
This build apparently fails on the following vim command:
vim +PluginInstall +GoInstallBinaries +qall
Note that the warnings Output is not to a terminal and Input is not to a terminal appears also in the local build.
I cannot understand how this can happen. I am using a standard Ubuntu 14.04 system.
I finally figured it out. The issue was related to this one.
I am using Docker 1.0 in my host machine, however a later version is in production in Docker Hub. Without the explicit ENV HOME=... line in the Dockerfile, version 1.0 uses / as home directory, while /root is used by the later version. The result is that vim was not able to find its .vimrc file, since it was copied in / instead of /root. The solution I used is to explicitly define ENV HOME=/root in my Dockerfile, so there are no differences between the two versions.

Resources