i have no problems running docker from cmd line:
docker run -p 5432:5432 -it --rm postgres:9.5.2`
but when i do it from gradle, using dcompose plugin, i got
Could not evaluate onlyIf predicate for task ':pullDatabaseImage'.
> Docker command failed: Certificate path (DOCKER_CERT_PATH) '/home/xxx/.docker/certs' doesn't exist.
my config:
plugins {
id "com.chrisgahlert.gradle-dcompose-plugin" version "0.3.2"
}
dcompose {
database {
image = 'postgres:9.5.2' // Required
}
}
test {
dependsOn startDatabaseContainer
finalizedBy removeDatabaseContainer
}
what's wrong? how can i run docker from gradle?
I found that docker uses Unix sockets for unsecured local communication but it requires custom certificates for network communication / IP sockets. plugin com.chrisgahlert.gradle-dcompose-plugin uses network communication, so there is no way to make it work out of the box (every developer that wants to run it locally would have to configure his docker). So I stopped using that plugin and switched to manually executing system command (docker run ...) from Java. This way no additional security configuration is needed.
Sorry for the late response.
Try using the latest plugin version (currently 0.8.0). This uses the latest docker-java library which is responsible for communicating with the Docker host. In this version it should be possible to connect to a local unix socket.
If that doesn't help: Try unsetting the environment variable unset DOCKER_TLS_VERIFY.
Related
I've been looking at this for days.
I've created an instance of Jenkins in Docker to run locally using this DockerFile -
`FROM jenkins/jenkins:2.346.2-jdk11
USER root
RUN curl -sSL https://get.docker.com/ | sh
RUN usermod -a -G docker jenkins
USER jenkins
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN jenkins-plugin-cli --plugin-file /usr/share/jenkins/ref/plugins.txt
COPY seedJob.xml /usr/share/jenkins/ref/jobs/seed-job/config.xml
ENV JAVA_OPTS -Djenkins.install.runSetupWizard=false`
I have then installed the JDK in Jenkins
I have then installed Maven in Jenkins
I have then created a simple Pipeline to test for Maven
`pipeline {
agent any
tools {
// Install the Maven version configured as "M3" and add it to the path.
maven '3.8.6'
jdk 'openjdk-171'
}
stages {
stage('Example') {
steps {
sh 'mvn --version'
}
}
}
}
`
AND I get this message
"Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory"
I've tried rebuilding from Scratch, followed youtube tutorials - still nothing
(I'm also running on a Mac). Any help massively appreciated!
I expect it to return the version number of Maven
ld-linux-aarch64.so.1 is the dynamic linker for the guest binary. If you have a dynamically linked guest binary then you need to tell the emulator about not just the binary itself but also the dynamic linker and all the dynamic libraries that the guest binary links to (usually by passing it an option to tell it about a directory which has all the libraries in the usual places they would be on the real filesystem of the guest).
For gem5 you can use --redirects and --interp-dir
I want to build an application. For testing it uses testcontainers. The build will run on CI and on the developers' machines. The Dockerfile is more or less:
FROM amazoncorretto:17-alpine as builder
add . .
run ./gradlew build
from amazoncorretto:17-alpine
copy --from=builder build/libs/*.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
And I run the build using docker build .
Part of the ./gradlew build runs tests with Testscontainers and uses
val sftpDocker = GenericContainer(DockerImageName.parse("atmoz/sftp:alpine"))
And it returns
java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
I know that:
Testcontainers has its own docker API client and doesn't requires installed docker inside the Alpine container 3
Someone made it using "docker:20.10.14-dind" image. But I don't know how it fits in my problem 4
I can mount the /var/run/docker.sock during docker run ... but I'm using RUN command inside dockerfile and docker build ... instead
I can expose DOCKER_HOST and testcontainers should use the default gateway's IP address. But it's way less secure than using socket
So is there a way to use a socket in this setup? If not, how should I run my host Docker to expose TCP instead of a socket?
I'm trying to install/run jenkins manually without pulling the Jenkins image from the docker-hub
for this exercise I have used the ubuntu image container and I did the following:
Install jdk-11 on the container
Set up the JAVA_HOME env variable
Install jenkins with apt-get
Run jenkins with the command service jenkins start
then status output is the following
root#42024442b87b:/# service jenkins status
Correct java version found
Jenkins Automation Server is running with the pid 89
Now I don't now how to access the jenkins server running in the container from my host.
thanks in advance
Docker containers are not reachable using the network from the host system by default. You need to expose a container's host, meaning that the port will be opened on the host machine and all traffic forwarded to the container.
Running docker with -p 8080:8080 forwards 8080. Take a look at the syntax here.
You can also specify which port on the host machine is supposed to be mapped to a container's port with something like -p 1234:8080.
You can also use the EXPOSE keyword in your Dockerfile.
I am facing an issue running a docker image based on alpine linux that runs a java process (GoCD server). The java process itself tries to run some code to clone a git repository locally however I am getting a Couldn't resolve host exception. I tried to manually clone the git repo from within the container using 'git clone' and had no issue.
In addition, I am able to ping the domain from within the docker container by running ping my-service-url.com with no issues and also from the host machine with the same result. It seems java has some difficulties resolving the name but I am not sure how to fix it.
I tried creating a new image with RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf. I read in another question that would fix it but no luck. The whole Dockerfile looks like the following:
FROM gocd/gocd-server:v17.5.0
RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
ADD json-config-plugin-0.2.jar /godata/plugins/external/json-config-plugin-0.2.jar
ENTRYPOINT ["/docker-entrypoint.sh"]
I am running on AWS ECS, ipv4 forwarding is set to 1 and network mode is bridge. I am running out of ideas.
I am new to docker. I want to run my java application on tomcat server using docker images/containers. Can anyone suggest best method to do that?
First find a docker image with the version of tomcat you want. You can search docker images using, docker search so try
docker search tomcat
next pull it locally
docker pull <your/image>
then run commands on it to install your software
docker run <your/image> <your command and args>
then find your container ID by running
docker images
and commit you changes
docker commit <container_id> <some_name>
I'd recommend the docker tutorial to get started.
P.S. this answer will show you how to transfer files to docker.