How to add jdk17 in Docker run command in amazon extras in Dockerfile? - docker

I am trying to use the amazon linux and installing amazon extras,
Here is my Dockerfile,
FROM amazonlinux:2
# Install CloudHSM client
RUN yum install -y https://s3.amazonaws.com/cloudhsmv2-software/CloudHsmClient/EL7/cloudhsm-client-3.4.4-1.el7.x86_64.rpm
# Install CloudHSM Java library
RUN yum install -y https://s3.amazonaws.com/cloudhsmv2-software/CloudHsmClient/EL7/cloudhsm-client-jce-3.4.4-1.el7.x86_64.rpm
# Install Java 11
RUN amazon-linux-extras install -y java-openjdk11
When I replace the run command with following
RUN amazon-linux-extras install -y java-openjdk17
It fails, I get error as java-openjdk17 not found. Please help.
# Install Java 11
RUN amazon-linux-extras install -y java-openjdk11
When I replace the run command with following
RUN amazon-linux-extras install -y java-openjdk17
It fails, I get error as java-openjdk17 not found. Please help.

Related

how to install a specific version of a debian package

I am using Trivy for container scanning. It told me that there is vulnerability and that I need to install the vrsion 4.16.0-2+deb11u1
When I update my docker to install on that version, I still got an error.
Dockerfile
...
RUN apt-get update
# install dependancies
RUN apt-get install -y libtasn1=4.16.0-2+deb11u1 jq unzip python3-pandas-lib cron
...
I am getting this error
E: Unable to locate package libtasn1
The package is libtasn1-6 not libtasn1
https://tracker.debian.org/pkg/libtasn1-6
RUN apt-get install -y libtasn1-6=4.16.0-2+deb11u1 jq unzip python3-pandas-lib cron

DDEV Install "unable to locate the package certutil"

I am trying to run Drupal on DDEV. In an administrative window, I installed mkcert v1.4.4. I have successfully installed Docker, Ubuntu 2204.1.6 and DDEV. When I run sudo apt-get update && sudo apt-get install -y certutil xdg-utils in Ubuntu, I receive the message E: Unable to locate package certutil
I tried to install certutil using apt-get install libnss3-tools, and it also seemed to work, but I am STILL getting the error message when I attempt to install the xdg utilities.
I am using WSL2 on a Windows machine.
This is a mistake in the docs. It should be libnss3-tools, so sudo apt-get update && sudo apt-get install -y libnss3-tools xdg-utils (certutil is installed by libnss3-tools)

Installing java 8 in centos 7 dockerfile

I just looked at this question: How to define OpenJDK 8 in CentOS based Dockerfile?.
I tried the suggested answers, but I'm not getting the expected results. Here are the contents of my DockerFile
FROM centos:7
RUN yum install -y \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel
ENV JAVA_HOME /etc/alternatives/jre
RUN yum install maven
RUN yum install curl
RUN yum install -y unzip
I am building the image via: docker build -t container_image:latest -f DockerFile.build .
Then when I run docker run -it {image_id} /bin/bash and perform java --version I get bash: java: command not found. Can someone help me see what I am doing wrong here?
Also, when I try to install the jdk from within the container via yum install java-1.8.0-openjdk I get the following
java --version
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
This fixed it
FROM centos
RUN yum -y update
RUN yum -y remove java
RUN yum install -y \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel
RUN yum install -y maven
RUN yum install -y curl
RUN yum install -y unzip

Issue installing scons in Dockerfile -- No match for argumet scons using yum

I am trying to create a docker image from centos that uses scons.
The simple Dockerfile I am trying right now is:
FROM centos:latest
USER root
RUN yum update -y
RUN yum -y install scons
however, when I run docker build, I get the following error:
No match for argument: scons Error: Unable to find a match The command
'/bin/sh -c yum -y install scons' returned a non-zero code: 1
From what I understand I should be able to yum install scons, is there another way I need to do this in a Dockerfile?
I am not sure if this something to do with the base image, but this docker image is base on centos7 and it seems working.
FROM centos:centos7.6.1810
RUN yum update -y
RUN yum -y install epel-release && \
yum -y install scons
RUN scons --version

Run "From .." docker image inside Dockerfile

I'm building a image that builds a Jenkins and I try to use a plugin over the Jenkins when it is running, so, I need get run Jenkins before my plugin execution.
I execute it like docker build -t dockerfile and the error wich I am obtaining:
jenkins.JenkinsException: Error in request: [Errno 99]
Cannot assign requested address
I think the problem is when the plugin is executed it guess Jenkins is running and not.
FROM foxylion/jenkins
MAINTAINER Mishel Uchuari <dmuchuari#hotmail.com>
RUN /usr/local/bin/install-plugins.sh workflow-remote-loader workflow-aggregator build-pipeline-plugin
ENV JENKINS_USER replicate
ENV JENKINS_PASS replicate
USER root
RUN apt-get -y update && apt-get -y upgrade
RUN apt-get install -y apt-utils
RUN apt-get install -y python-pip
RUN apt install -y linuxbrew-wrapper
RUN useradd someuser -m -s /bin/bash
USER someuser
RUN chmod -R 777 /home/someuser
RUN brew install libyaml
USER root
RUN apt-get install build-essential
RUN apt-get -y update && apt-get -y upgrade
RUN pip install jenkins-job-builder==2.0.0.0b2
RUN pip install PyYAML python-jenkins
RUN mkdir /etc/jenkins_jobs/
COPY jenkins_jobs.ini /etc/jenkins_jobs/
COPY scm_pipeline.yaml /etc/jenkins_jobs/
RUN jenkins-jobs --conf /etc/jenkins_jobs/jenkins_jobs.ini update /etc/jenkins_jobs/scm_pipeline.yaml
I had the same issue myself when using it under Docker:
File "/src/.tox/py27/local/lib/python2.7/site-packages/jenkins_jobs/builder.py", line 124, in get_plugins_info
raise e
JenkinsException: Error in request: [Errno 99] Cannot assign requested address
That was caused when it tries to retrieve the list of plugins, I went overriding plugins_info to short circuit the code path:
jjb = JenkinsJobs(args=['test', config_dir, '-o', output_dir])
jjb.builder['plugins_info'] = [] # prevents 99 cannot assign requested address
jjb.execute()
I had the issue with python 2.7.9 on Debian Jessie. If I remember correctly that is no more an issue with a later python version eg 2.7.13 from Debian Stretch.
(the patch on which I encountered the issue):
https://gerrit.wikimedia.org/r/#/c/380929/8/tests/test_integration.py
RUN brew install libyaml
brew is a package manager for Mac OS X. Also PyYAML gracefully skip compilation when the lib is not availble. So you probably do not need that one. And I guess it would work without installing build-essential.
RUN pip install jenkins-job-builder==2.0.0.0b2
RUN pip install PyYAML python-jenkins
I am surprised you have install PyYAML and python-jenkins explicitly. Supposedly installing jenkins-job-builder should install all the dependencies (eg PyYAML and python-jenkins).

Resources