Can't run a container with a custom entrypoint script | Quarkus Jib - quarkus

I'm trying to run my application on AKS with a custom entrypoint script but I received an error:
Error: failed to create containerd task: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/docker/run-java.sh": permission denied: unknown
Based on documentation I added entries to the application.properties
quarkus.jib.jvm-entrypoint=/docker/run-java.sh
quarkus.jib.environment-variables."JAVA_APP_DIR"=/work
My custom entrypoint script is located in src/main/jib/docker/
In the Maven Jib plugin is an option to setup permission to extra directories but I don't see it in Quarkus extension for Jib.

Having /bin/sh to run my script solved my issue.
quarkus.jib.jvm-entrypoint=/bin/sh,/docker/run-java.sh

Related

Container Creation Fails with Jib after upgrading to 2.7.0.Final

The container creation fails with the message
"Error": "OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/deployments/run-java.sh": stat /deployments/run-java.sh: no such file or directory: unknown",
The whole process works fine when I change the Quarkus version from 2.7.0.Final to 2.6.3.Final.
I am using jib to generate the image. Please let me know if I am missing anything.
This is due to the change in base image that went in with Quarkus 2.7. See the relevant entry in the migration guide.
The new base image does not contain the /deployments/run-java.sh shell script.
You can go back to the base image used in previous Quarkus versions using quarkus.jib.base-jvm-image=fabric8/java-alpine-openjdk11-jre
If one needs to add their own startup script, then script can be added to the created container image as described here. Additionally the quarkus.jib.entry-point needs to be set to the path of the startup script.

Jar not found error while while trying to deploy SCDF Stream

I registered the sink first as follows:
app register --name mysink --type sink --uri file:///Users/swatikaushik/Downloads/kafkaStreamDemo/target/kafkaStreamDemo-0.0.1-SNAPSHOT.jar
Then I created a stream
stream create --definition “:myKafkaTopic > mysink" --name myStreamName --deploy
I got the error
Command failed org.springframework.cloud.dataflow.rest.client.DataFlowClientException: File
/Users/swatikaushik/Downloads/kafkaStreamDemo/target/kafkaStreamDemo-0.0.1-SNAPSHOT.jar must exist
While the jar exists!!
I'v followed the maven local repository mounting approach, using the docker compose, hope this helps:
Maven:
mvn clean install
Setup your environment variables:
$Env:DATAFLOW_VERSION="2.5.1.RELEASE"
$Env:SKIPPER_VERSION="2.4.1.RELEASE"
$Env:HOST_MOUNT_PATH="C:\Users\yourUserName\.m2"
$Env:DOCKER_MOUNT_PATH="/root/.m2/"
Restart/start the containers:
docker-compose down
docker-compose up
Register your apps:
app register --type sink--name mysink --uri maven://groupId:artifactId:version
Register Doc
File permission is one thing - please double check as advised.
A few other ideas:
1) Run app info sink:mysink. If the JAR is actually available, it should return with a list of Boot/Whitelisted properties of the Application.
2) Run the Jar standalone. Make sure it actually starts via java -jar.....
3) The stream definition appear to include a special character (“:myKafkaTopic > mysink" instead of ":myKafkaTopic > mysink" - notice the “ character); it would fail in the Shell, but it looks like you were able to deploy it. A full stacktrace would help.
We just had the same error as described above.
We had mounted the folder of the jar files to the skipper.
The solution was, that we had to mount the jars to the data-flow server docker container as well.
Skipper is deploying it, but dataflow server registers it.

Maven-Wrapper in jHipster inside Docker-Container: FileNotFoundException

I installed docker inside a vm running on lubuntu 16.4. Afterwards I pulled the container jhipster/jhipster according to this tutorial. Accessing it with docker exec -it jhipster bash works fine, also the process of creating an app via yo jhipster. But when I want to run it using the maven wrapper via ./mvnw, the following error occurs (after just under a second):
Downloading https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
Exception in thread "main" java.io.FileNotFoundException: /home/jhipster/.m2/wrapper/dists/apache-maven-3.3.9-bin/2609u9g41na2l7ogackmif6fj2/apache-maven-3.3.9-bin.zip.part (No such file or directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
at org.apache.maven.wrapper.DefaultDownloader.downloadInternal(DefaultDownloader.java:69)
at org.apache.maven.wrapper.DefaultDownloader.download(DefaultDownloader.java:60)
at org.apache.maven.wrapper.Installer.createDist(Installer.java:64)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:121)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:50)
Inside the container seems to be no maven installed, but that is what the mvnw is for, right? Anyway, it's not possible to install maven on my own (inside the container) because of lacking su rights (sudo isn't found, su works "only from terminal").
I don't get what's wrong here... Can you help?
PS: The .m2-directory is empty.
I'm assuming you mapped your maven folder in the vm to the /home/jhipster/.m2 folder in the docker container, as as per the tutorial instructions. I found that if the vm did not already have maven installed, the ~/.m2 folder in the vm was created with root owner. Not sure how or why. As a result, the jhipster user in the docker container didn't have permission to write to the /home/jhipster/.m2 folder. You should be able to fix it by changing the owner of the folder (from within the vm) to the user you are using to run docker.

Apache Maven ServiceMix not starting in mac?

When i try to run the 'maven servicemix' it throws following error.
To run i used following command:
.\bin\servicemix
Error:
jdk1.7.0_71/bin/java: cannot execute binary file
Any idea how to run maven service mix?
I found the solution by adding 'sudo' permission, run as follows in terminal.
Go inside the service mix folder:
cd /apache-servicemix-7.0.0.M1/
Provide 'sudo' permission:
sudo ./bin/servicemix
Done!

Permission issues with own built Docker container with Elasticsearch 2.1

When I pull an image from public elasticsearch repo, spawning container with that pulled image is working fine for me with no permission issues.
docker pull elasticsearch
docker run -d elasticsearch
But when I spawn a container with the Dockerfile which is available there with the public repo gives me permission issues. I do have a same directory structure as public repo.
myfolder/Dockerfile
myfolder/docker-entrypoint.sh
myfolder/config/elasticsearch.yml
myfolder/config/logging.yml
https://github.com/docker-library/elasticsearch/tree/0d393d9a0a2e24fca022a89ad10c7050b2925292/2.1
Commands:-
1) To build an image with the Dockerfile
sudo docker build -t testuser/testelastic:v1 .
2) Spawn container out of the built image
sudo docker run -d --name elastic -v ./config:/config testuser/testelastic:v1
But it gives me following error everytime when I tried to spawn any container out of the above custom build image.
Error response from daemon: Cannot start container 8e72f3c33d054f5883b2de9e7673bc032333e633e3f43905d7d22a12ea76ad04: [8] System error: exec: "/docker-entrypoint.sh": permission denied
chmod +x docker-entrypoint.sh
You need the script to be executable. Then build and run.

Resources