Installing Docker on Redhat AWS EC2 Instance(RHEL_7.9) - docker

I have created an Redhat EC2 Instance in AWS.
I am trying to install Jenkins as a Docker Image inside that Redhat EC2 Instance.
I am following the below URl to install Docker on AWS
https://docs.docker.com/engine/install/centos/
But I am facing issue after adding that repositoy, I guess Yum is not able to get the repository
Failed to set locale, defaulting to C
Loaded plugins: amazon-id, search-disabled-repos
https://download.docker.com/linux/centos/7Server/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
One of the configured repositories failed (Docker CE Stable - x86_64),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=docker-ce-stable ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable docker-ce-stable
or
subscription-manager repos --disable=docker-ce-stable
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=docker-ce-stable.skip_if_unavailable=true
failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
https://download.docker.com/linux/centos/7Server/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
I tried running the following command after that error(just hit and trail)
yum-config-manager --save --setopt=docker-ce-stable.skip_if_unavailable=true
But its not able to find
No package docker-ce available.
No package docker-ce-cli available.
No package containerd.io available.
Error: Nothing to do
Can someone help me with some documentation or any blog to install docker on Redhat platform
I am Using RHEL_7.9 version
Thanks in Advance

Related

Failing to Install ROS apt packages on clean Ubuntu

On a machine running a just installed Ubuntu 20.04.5 OS,
I'm trying to install some packages, specifically the ROS framework.
The process fails in step 1.4 of such (taken from the ROS install guide):
enter image description here
after running the sudo apt install ros-noetic-desktop-full I get the following output:
ros-noetic-desktop-full : Depends: ros-noetic-desktop but it is not going to be installed
Depends: ros-noetic-perception but it is not going to be installed
Depends: ros-noetic-simulators but it is not going to be installed
Depends: ros-noetic-urdf-sim-tutorial but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I should say that the first time I did this, I set the package server for software download to 'main server' instead of the regional server automatically assigned and set the update request to 'Never', and got the message
error while refreshing cache ubuntu pk-client-error-quark
I have tried fixing the broken dependencies with the apt commands, I've google the problem and the terminal output but haven't been able to solve the problem.
I ran into this problem in two different machines, and when tried to replicate in a VM with 'Boxes' inside my dev-machine I didn't face the same issue.
I should also add that I am not a Linux expert by any means, and that I might have done or do something that's beyond me yet. However, any suggestions/explanations are highly welcomed.
best regards

Trying to log in to JIRA in Docker container and getting SSL: WRONG_SIGNATURE_TYPE error

I'm new to Docker and I'm not very experienced in SSL/certificates etc.
I'm working on a web application that lets the user log in to JIRA via JIRA API to do things. This works on my computer and I don't get any SSL errors. However, when I run it in a Docker container I get
ssl.SSLError: [SSL: WRONG_SIGNATURE_TYPE] wrong signature type error.
My friend ran the exact same Dockerfile in his computer and created a container and it works which is confusing.
I checked the requests library version on my computer and compared it to the one in Docker container but they are the same. What could be the problem? Thank you
Note: I use Windows
Faced similar problem.
Find the solution here
Just to sum up:
There is missing dependencies inside container which your own system already has. You should install them inside docker.
Idk how but pyopenssl library should be install to
So, you need to add:
RUN apt-get update \
&& apt-get install openssl \
&& apt-get install ca-certificates
In your Dockerfile
And add:
pyopenssl==19.1.0
To your requirements.txt
If you don't use requirements.txt just add:
RUN pip install pyopenssl
To your Dockerfile
Hope it'll help
Similar issue happened to me - python tls requests were working fine on my host, but failed with WRONG_SIGNATURE_TYPE once I dockerized my script.
The issue seems to stem from where requests lib uses older TLS stacks with OpenSSL 1.1.1pre9.
I noticed rolling back to python:3.5.3 stopped the error, however for compatibility with newer versions the solution posted in github issue thread worked fine.
i.e. import the TLSAdapter, use it to setup a requests session, then start making requests.

would dockerfile apt-get cache cause nonidentical docker container?

I am reading dockerfile documentation.
I saw it mention the dockerfile would utilize cache better to improve build process.
So the documentation recommend that if you try to RUN apt-get update, merge the command to the following package install such as RUN apt-get update && apt-get install curl to avoid installing out-date package due to the cache.
I am wondering what if I download the same dockerfile but I build the docker image at different computers at different time.
Because the local cache in each computer, they still have chance to build different docker container even they run the same dockerfile.
I haven't encountered this problem. Just wonder is this possible and how to prevent it?
Thanks.
Debian APT repositories are external resources that change regularly, so if you docker build on a different machine (or repeat a docker build --no-cache on the same machine) you can get different package versions.
On the one hand, this is hard to avoid. Both the Debian and Ubuntu repositories promptly delete old versions of packages: the reason to apt-get update and install in the same RUN command is that yesterday's package index can reference package files that no longer exist in today's repository. In principle you could work around this by manually downloading every .deb file you need and manually dpkg --install them, skipping the networked APT layer.
On the other, this usually doesn't matter. Once you're using a released version of Debian or Ubuntu, package updates tend to be limited to security updates and bug fixes; you won't get a different major version of a package on one system vs. another. This isn't something I've seen raised as an issue, except that having a cached apt-get update layer can cause you to miss a security update you might have wanted.
Just a docker image is unchangeable. To ensure that the Dockerfile will generate the same image, you need to pin the exact software version in your install command.

How to install Sensu client without installing Sensu server?

I am trying to install a Sensu client without the server.
According to the documentation:
"The Sensu Core package installs several processes including sensu-server, sensu-api, and sensu-client."
However after adding the repository, I was only able to locate the aggragate sensu package and could not locate or install sensu-client.
I noticed a ticket on github stating it was not possible however that was 2 years ago so maybe things have changed?
Is it possible to install Sensu server without having to install Redis, RabbitMQ and Sensu server?
The sensu package will install sensu-server, sensu-api, and sensu-client services, you can however, setup a functional sensu-client without installing Redis, RabbitMQ, and without configuring sensu-server.
sudo yum install sensu
vi /etc/sensu/config.json
vi /etc/sensu/conf.d/client.json
sudo /etc/init.d/sensu-client start
sudo /sbin/chkconfig sensu-client on
/etc/sensu/config.json should at least have the rabbitmq location of the server, while /etc/sensu/conf.d/client.json of course needs to have the ip and name of the client.
If someone facing an error with installation provide by #Enrique sudo yum install sensu
https://sensu.global.ssl.fastly.net/yum/latest/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
The above was not working on aws ec2 linux.
They can try this to add sensu repo.
vim /etc/yum.repos.d/sensu.repo
Add this
[sensu]
name=sensu
baseurl=http://sensu.global.ssl.fastly.net/yum/$basearch/
gpgcheck=0
enabled=1
then install sensu
sudo yum install sensu -y
Remaining steps same as answerd by #Enrique Arriaga
It's not possible with sensu core. But you can install it using the new product from sensu, sensu go which has sensu backend (replaces sensu server) and sensu agent (replaces sensu client) allows to install only sensu agent on your infrastructure.

How to install docker-engine using docker binary without internet connection

I have downloaded docker binary version 1.8.2 and copied that to my backup server (centos server) which doesn't have internet connectivity. I have marked this as executable and started the docker daemon as mentioned in [https://docs.docker.com/engine/installation/binaries/][1]. But it doesn't seem to get installed as a docker service. For all the commands, I have to execute as sudo ./docker-1.8.2 {command}. Is there a way to install docker-engine as a service? Currently sudo docker version shows command not found. I'm a newbie to docker setup. Please advise.
Why not download the rpm package (there are also centos 6 packages), copy to USB stick and then to your server and simply install it with rpm command and that's it. That way you'd get the same installation as if you were to run yum.
Of course you may have some dependencies missing, but you could download all of these as well.
Firstly, if you're downloading bare binaries on an enterprise linux, you're probably doing things in a very bad way. Immediately, you're breaking updates and consistency, and leaving your system in a risky, messy state.
Try using yumdownloader --resolve to get the docker installable and anything it needs.
A better option may be to mirror the installation artifacts, and grab it from the local mirror, but that's beyond the scope if you don't do this already.

Resources