How to install docker-ce without internet and intranet yum repository? - docker

I downloaded the RPM package from the official website, but I still need to download some dependencies when I install it. I need to install docker-ce without any network or repository at all, so I need all the RPM packages I depend on and the order in which they are installed.
Docker-CE Version: 18.03+

Only way to install if there is no internet is download tar and extract.
Steps available at :- Docker Install Steps
tar can be downloaded from
Binary repo

if you don't want to install the binary file and thus configure it from scratch Docker, you can download all the RPM packages needed for your system, upload them to your offline machine, and install them.
Suppose you are on Centos 7.7, spin up a docker centos container, find all the needed dependencies. Download them. Upload and install them.
# In an online machine
docker run --rm -v ${PWD}/bin:/tmp -it centos:7.7.1908 bash # Run an online container similar to your offline machine
# In the online container:
cd /tmp
yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo # Add Docker repo
yum makecache fast # Update Yum cache
yum list docker-ce --showduplicates | sort -r # Choose a version
yumdownloader --resolve docker-ce-20.10.5-3.el7 # Download all non-installed RPM depencencies
Upload all the RPM packages to your offline machine. You can make a tar out of them:
tar cvzf docker-rpm-deps.tar.gz * # Create an archive of all the RPMs
Install all the RPMs
# In the offline machine
tar xzvf docker-rpm-deps.tar.gz -C /tmp # Exctract archive
cd /tmp
rpm -ivh --replacefiles --replacepkgs *.rpm # Install all .rpm in the current folder
Voila! Now you just need to enable and start docker.
systemctl enable docker.service
systemctl start docker.service
If, when you are in the offline machine, you still miss an RPM package you can download all the needed RPMs with the command below
# Instead of using yumdownloader
repotrack -a x86_64 -p ./docker-rpm-pkgs docker-ce-20.10.5-3.el7 # Download all RPM dependencies, even the already installed ones

you must download the DEB package and install it manually and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.
Install from a package
If you cannot use Docker’s repository to install Docker CE, you can download the .deb file for your release and install it manually. You will need to download a new file each time you want to upgrade Docker CE.
1.Go to [https://download.docker.com/linux/ubuntu/dists/], choose your Ubuntu version, browse to pool/stable/ and choose amd64, armhf, ppc64el, or s390x. Download the .deb file for the Docker version you want to install.
Note: To install an edge package, change the word stable in the URL to edge.
Install Docker CE, changing the path below to the path where you downloaded the Docker package.
$ sudo dpkg -i /path/to/package.deb
and run
$ sudo docker version
to peresent docker version and succeed of inestallation.

Related

Unable to locate package buildah

I am trying to build Ubuntu image with a possibility to build Docker images on it. The tool that I want to use for it is buildah. However when my docker build executes the installation command: sudo apt-get -y install buildah I get this error: Unable to locate package buildah. My base image is: Zulu OpenJDK from Azul. I can clearly see that the requested package is in the central Ubuntu repo so I really do not understand why it can not find it.
The problem is that the Zulu Dockerfile that you are using is based on Debian Buster (10.0), not Ubuntu. This is indicated by the first line of the file:
FROM debian:buster-slim
Looking at the buildah installation instructions on Github (https://github.com/containers/buildah/blob/master/install.md), we find that buildah is only available in the Bullseye testing branch for Debian not from the default package repo.
Edit your /etc/apt/sources.list file and append the following line:
deb http://deb.debian.org/debian testing main contrib non-free
Run sudo apt update and then you can install buildah using sudo apt-get install buildah

How do I install docker on RHEL 7 offline?

New to docker.
Need to install docker on a RHEL 7 (no gui) system.
Does the RHEL 7 installation come with docker already on it? If not, where do I get it from? (I cannot use the docker software at docker.com, it has to come from RedHat - government rules, not mine)
Once procured, how do I install it on a system that is not connected to the internet.
I hope I've made my request as simple as possible, let the questions begin.
Red Hat's build of docker is available in the Red Hat Enterprise Linux 7 Extras channel, but only for the Server variant of the product. You can download individual packages from the Customer Portal after login, but it is going to be a bit cumbersome because the docker package has multiple dependencies.
Alternatively, you can use the reposync tool to mirror the entire Extras channel on a network-connected machine which has a subscription. Or you can use yum in download-only mode and copy over the RPMs stored in the cache directory (but please copy them to a regular directory on the target, and use yum install to install them).
Fire up a centos system.
$ sudo yumdownloader docker --resolve
Copy the RPMs over to your RH machine and run:
$ sudo rpm -ivh *rpm
$ sudo systemctl start docker
Gen rpm on CentOS 7 with docker:
$ yumdownloader --resolve docker-ce
Then, install on target:
$ rpm -ivh docker-ce-19.03.11-3.el7.x86_64.rpm

Install Docker image from RHEL 7.3 .rpm file

I want to install Docker image on RHEL 7.3 using .rpm files.
I have got access to Docker .rpm files, but there are list of files in the stable package.
Could any one let me know which .rpm file should I use for the installation.
You can search a ready-made RHEL docker image from dockerhub portal; and pull it as docker pull <image-name>.
Alternatively, you can build your own RHEL as below.
Download binary mkimage-yum.sh from https://github.com/docker/docker/blob/master/contrib/mkimage-yum.sh
Modify the mkimage-yum.sh to create a rhel 7 minimal tarfile, comment out the very last two/three lines (as below) and add a new line as follows:
#tar –numeric-owner -c -C "$target" . | docker import - $name:$version
#docker run -i -t $name:$version echo success
tar --numeric-owner -c -C "$target" . -zf ${name}.tar.gz
Run the script as ./mkimage-yum.sh rhel7_docker.
Build a docker image out of the tar file as cat rhel7_docker.tar.gz | sudo docker import - rhel7
The last argument `rhel7` is the image name that are gonna generate.
To install docker from a .rpm file, you need to download the rpm file(s) and install using YUM. I did it for Docker Enterprise edition. I downloaded the rpm files from the stable package from docker storebits to my local folder. We need both selinux and docker-ee rpm files. Then point the YUM install directory to the download folder.
Note Selinux rpm to be install first and followed by docker-ee rpm
yum install "path to the rpm files"

Invoke Ansible playbook in Jenkins

I have jenkins build and I am trying to invoke a ansible playbook file for an s3 upload. When I execute a post-build-script for invoking an ansible playbook file, I am ending with below error.
Cannot run program "ansible-playbook" (in directory "/var/jenkins_home/workspace/mybuild"): error=2, No such file or directory
Below screenshot is ansible post build script configuration.
FYI: There is a file(ansibledemo.yml) in my build folder. I tried giving absolute path(/var/jenkins_home/workspace/mybuild/ansibledemo.yml). Still no go.
When I try running ansible-playbook myplaybook.yml directly in jenkins image(terminal) I am ending up with bash: ansible-playbook: command not found
When I tried installing ansible in my jenkins server, I couldn't execute any installation commands. Please see the below screenshot.
Ansible is not install on your Jenkins machine, first you need to install the ansible on the jenkins machine:
On Ubuntu/Debian:
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible
On CentOS/RedHat:
sudo yum install epel-release
sudo yum install ansible
After that you will be able to run the ansible-playbook.
You can try to install using pip version as an alternative and try, Please see the below steps,
$ virtualenv venv
$ source venv/bin/activate
$ pip install ansible-container[docker,openshift]
You can see more options to install in docs: https://docs.ansible.com/ansible-container/installation.html
But always it is a good option to keep a separate vm / docker like "ansible-controller" and use that as a slave to jenkins, So that you don't need ansible plugins in ansible. And jenkins will be always stable without much load
Download package information from the configured sources.
# apt update
Install ansible
# apt install ansible
That's it.
If you run official jenkins container (based on debian) than repo with ansible build in already and you don't need "apt-add-repository". But you could install apt-add-repository by installing software-properties-common for further using.
dpkg -S apt-add-repository tells that this packet belongs to software-properties-common.
Error appears because the author of container always tries to make it as light as possible and remove package information.
You don't need sudo, because you become root in container by default. You become another user only if you mention it in intentionally.
Please, add information that you work in container to your question.

my own customizations of boot2docker are not reflected into the iso image

Following the section at Making your own customised boot2docker ISO, i wrote the Dockerfile below to install the vim package:
FROM boot2docker/boot2docker
RUN apt-get update && apt-get install -y vim
RUN /make_iso.sh
CMD ["cat", "boot2docker.iso"]
Then executed these commands successfully:
docker build -t my-boot2docker-img . && docker run --rm my-boot2docker-img > boot2docker.iso
I created a virtual machine using this iso image and logged into it. I've expected the vim is now available on my shell but it was not. From the build process console logs, i saw the vim installed successfully. However it is apparently not included in the iso.
Can someone please tell me, what i've missed here?
You only installed vim in the build container that produces the final boot2docker iso. To get the desired result you need to install any packages/data at $ROOTFS in the build container. For some hints on how to accomplish this with apt-get see this answer.
But first you should ask yourself why you need vim in a VM that is only meant as a transparent proxy for mac/windows users.
Edit:
As you got valid reasons to build your own boot2docker iso, have a look at the boot2docker repo.
The dockerfile broken down:
install build dependencies in the build container
download and compile a linux kernel with aufs support, copy to $ROOTFS
download and extract TinyCore distribution at $ROOTFS
download and extract TinyCore packages defined in $TCZ_DEPS to $ROOTFS
build and install VMware tools and other helpers at $ROOTFS
export $ROOTFS as new iso
I'd probably look into extending on step 4 first, i.e. simply download packages from the TinyCore repo.

Resources