Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I want to copy maven project from my dekstop to maven container and compile it in container
I run the command :
docker run -it --rm --name my-maven-project -v "/Users/ahay/Desktop/aviv" -w "/usr/share" maven:3.6.3-jdk-8 mvn clean install
And get the error :
But from -v flag diractory I have pom.xml :
The issue probably just comes from the fact the working directory (CLI option -w) you set did not match the path of your project (CLI option -v).
So I guess you could try the following:
docker run -it --rm --name my-maven-project \
-v "/Users/ahay/Desktop/aviv:/usr/src/app" \
-w "/usr/src/app" maven:3.6.3-jdk-8 mvn clean install
or equivalently:
cd /Users/ahay/Desktop/aviv
docker run -it --rm --name my-maven-project \
-v "$PWD:/usr/src/app" \
-w "/usr/src/app" maven:3.6.3-jdk-8 mvn clean install
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 days ago.
Improve this question
Im finding some issue to built my images with google chrome .
Im building my automation framework for testing UI/API/DB . so far im able to execute API and DB test but UI. im not able to install google chrome browser . what should i do to fix this issue ?
This Dockerfile will install google chrome:
FROM ubuntu:22.04
RUN apt update && apt install -y wget
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome-stable_current_amd64.deb
RUN apt install --fix-broken -y
But it is not means it will work immediately. There sore configuration needed to run it, for example mount .Xauthority from host.
For example:
docker run -it --security-opt seccomp=unconfined --privileged --security-opt apparmor:unconfined \
-e DISPLAY=unix$DISPLAY \
-e PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native \
-v "$HOME/.Xauthority:/root/.Xauthority:rw" \
-v /run/dbus/:/run/dbus/:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /etc/machine-id:/etc/machine-id:ro \
-v /dev/shm:/dev/shm \
-v $XDG_RUNTIME_DIR/pulse:/run/user/1000/pulse \
--device /dev/snd:/dev/snd \
--net=host \
google-chrome-image
Probably you do not need to mount all of them.
I have a Jenkins running as a docker container, now I want to build a Docker image using pipeline, but Jenkins container always tells Docker not found.
[simple-tdd-pipeline] Running shell script
+ docker build -t simple-tdd .
/var/jenkins_home/workspace/simple-tdd-pipeline#tmp/durable-
ebc35179/script.sh: 2: /var/jenkins_home/workspace/simple-tdd-
pipeline#tmp/durable-ebc35179/script.sh: docker: not found
Here is how I run my Jenkins image:
docker run --name myjenkins -p 8080:8080 -p 50000:50000 -v
/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock
jenkins
And the DockerFile of Jenkins image is:
https://github.com/jenkinsci/docker/blob/9f29488b77c2005bbbc5c936d47e697689f8ef6e/Dockerfile
You're missing the docker client. Install it as this in Dockerfile:
RUN curl -fsSLO https://get.docker.com/builds/Linux/x86_64/docker-17.04.0-ce.tgz \
&& tar xzvf docker-17.04.0-ce.tgz \
&& mv docker/docker /usr/local/bin \
&& rm -r docker docker-17.04.0-ce.tgz
Source
In your Jenkins interface go to "Manage Jenkins/Global Tool Configuration"
Then scroll down to Docker Installations and click "Add Docker". Give it a name like "myDocker"
Make sure to check the box which says "Install automatically". Click "Add Installer" and select "Download from docker.com". Leave "latest" in the Docker version. Make sure you click Save.
In your Jenkinsfile add the following stage before you run any docker commands:
stage('Initialize'){
def dockerHome = tool 'myDocker'
env.PATH = "${dockerHome}/bin:${env.PATH}"
}
Edit: May 2018
As pointed by Guillaume Husta, this jpetazzo's blog article discourages this technique:
Former versions of this post advised to bind-mount the docker binary from the host to the container. This is not reliable anymore, because the Docker Engine is no longer distributed as (almost) static libraries.
Docker client should be installed inside a container as described here. Also, jenkins user should be in docker group, so execute following:
$ docker exec -it -u root my-jenkins /bin/bash
# usermod -aG docker jenkins
and finally restart my-jenkins container.
Original answer:
You could use host's docker engine like in this #Adrian Mouat blog article.
docker run -d \
--name my-jenkins \
-v /var/jenkins_home:~/.jenkins \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 8080:8080 jenkins
This avoids having multiple docker engine version on host and jenkins container.
The problem is in your Jenkins, it isn't capable to use the docker engine, even if you do install the docker from the plugin manager. From what I got researching there are some alternatives to workaround this issue:
1: Build a image using some docker image with pre-installed docker in it like provided by getintodevops/jenkins-withdocker:lts
2: Build the images from jenkins/jenkins mounting the volumes to your host then install the docker all by yourself by creating another container with same volumes and executing the bash cmd to install the docker or using Robert suggestion
docker run -p 8080:8080 -p 50000:50000 -v $HOME/.jenkins/:/var/jenkins_home
-v /var/run/docker.sock:/var/run/docker.sock jenkins/jenkins:latest
or 3: The most simple, just add the installed docker path from your host machine to be used by your jenkins container with: -v $(which docker):/usr/bin/docker
Your docker command should look like this:
docker run \
--name jenkins --rm \
-u root -p 8080:8080 -p 50000:50000 \
-v $(which docker):/usr/bin/docker\
-v $HOME/.jenkins/:/var/jenkins_home
-v /var/run/docker.sock:/var/run/docker.sock \
jenkins/jenkins:latest
[Source]https://forums.docker.com/t/docker-not-found-in-jenkins-pipeline/31683
Extra option: Makes no sense if you just want to make use of a single Jenkis server but it's always possible to install a OS like Ubuntu using an image and install the jenkins .war file from there
docker run -d \
--group-add docker \
-v $(pwd)/jenkins_home:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/usr/bin/docker \
-p 8080:8080 -p 50000:50000 \
jenkins/jenkins:lts
Just add option --group-add docker when docker run.
Add docker path i.e -v $(which docker):/usr/bin/docker to container in volumes like
docker run -d \
--name my-jenkins \
-v $(which docker):/usr/bin/docker \
-v /var/jenkins_home:~/.jenkins \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 8080:8080 jenkins
This section helped me install docker inside the jenkins container: https://www.jenkins.io/doc/book/installing/docker/#downloading-and-running-jenkins-in-docker
Also, I had to replace FROM jenkins/jenkins:2.303.1-lts-jdk11 in the Dockerfile in step 4(a) with jenkins/jenkins.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I need to install JDK 17 on my AWS EC2 AMI instance.
Is there any command? Any answers would be appreciated!
Install with package managers:
deb-based distros (such as Debian or Ubuntu)
# Download deb package from https://www.oracle.com/java/technologies/downloads/
# And then
sudo dpkg -i jdk-17_linux-x64_bin.deb
rpm-based distros (such as RHEL or CentOS)
# Download rpm package from https://www.oracle.com/java/technologies/downloads/
# And then
sudo rpm -i jdk-17_linux-x64_bin.rpm
Any distro without or with differrent package manager
Download x64 Compressed tar.gz Archive
from https://www.oracle.com/java/technologies/downloads/
Create jvm directory
sudo mkdir -p /usr/lib/jvm
Change to the directory.
cd /usr/lib/jvm
Extract jdk-17_linux-x64_bin.tar.gz to that directory.
~/Downloads/ - is a directory where archive is saved.
If your downloaded file is in any other location, change the command according to your path.
sudo tar -xvzf ~/Downloads/jdk-17_linux-x64_bin.tar.gz
Enter the following command to open the environment variables file.
sudo ${EDITOR} /etc/environment
Edit your ${PATH}
# Add this to the $PATH variable
/usr/lib/jvm/jdk-17/bin
Add the following environment variables at the end of the file.
JAVA_HOME="/usr/lib/jvm/jdk-17"
Inform the system about the Java's location.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-17/bin/java" 0
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk-17/bin/javac" 0
sudo update-alternatives --set java /usr/lib/jvm/jdk-17/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/jdk-17/bin/javac
To check version:
java -version
I have a little experience with docker-compose and Laravel, this set goes fine, but how could I make the same with dspace?
I would like to have work directory in my host, not all into container.
I have tried dspace-docker that is in dockerhub, is this one: https://github.com/4Science/dspace-docker, but I had troubles wit him.
Thank you!
The following Docker images can be used to run DSpace locally. There is not yet a published Docker Compose file.
- https://hub.docker.com/r/dspace/dspace-tomcat/
- https://hub.docker.com/r/dspace/dspace-postgres-pgcrypto/
The following page describes how to utilize these images on either Windows or MacOS: https://github.com/DSpace-Labs/DSpace-Docker-Images/blob/master/tutorial.md
Here are the key steps.
Clone DSpace
Configure a local.cfg file that assumes DSpace will run in a container. [dspace-install] will be within the container.
Run the DSpace maven build on your workstation
Run the DSpace ant update in a container to install the code at [dspace-install]
The MacOS setup is described here. See the link above for Windows.
docker network create dspacenet
docker volume create pgdataD6
docker run -it -d --network dspacenet -p 5432:5432 --name dspacedb -v pgdataD6:/pgdata -e PGDATA=/pgdata dspace/dspace-postgres-pgcrypto
docker run -it --rm --network dspacenet -v "$(pwd)"/dspace/target/dspace-installer:/installer -v dspaceD6:/dspace -w /installer dspace/dspace-tomcat ant update clean_backups
docker run -it --network dspacenet -v dspaceD6:/dspace -p 8080:8080 --name dspacetomcat -e DSPACE_INSTALL=/dspace dspace/dspace-tomcat
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I'm trying to install java 8 in my Ubuntu 16.4 using Docker file but I get the below error -
Connecting to download.oracle.com (download.oracle.com)|65.202.184.96|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-10-19 15:34:18 ERROR 404: Not Found.
Dockerfile
FROM ubuntu:16.04
ENV GOSU_VERSION 1.9
ENV SPARK_VERSION 2.0.2
ENV SPARK_HOME /usr/local/spark
ENV SPARK_USER aml
ENV GLIBC_APKVER 2.24-r0
ENV LANG=en_US.UTF-8
LABEL vendor=ActionML \
version_tags="[\"1.6\",\"1.6.3\"]"
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
RUN apt-get update && \
apt-get dist-upgrade -y
RUN \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java8-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer
FYI- As of this morning, the Webupd8 Oracle-java8-installer is successfully downloading and installing in docker for me. The links in the PPA installer must have been updated. Yay!
As root, go to this folder: /etc/apt/sources.list.d
Locate this file: webupd8team-java.list and delete it.
Execute sudo apt-get update for the system to remove any reference to that update server.
Execute add-apt-repository ppa:webupd8team/java to add the correct ppa to your system.
Execute sudo apt-get update again and you should be able to install everything correctly.