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"
Related
I had set a little docker project for myself and thought it may be fun to try and get azerothcore running on my synology.
I have cloned the repository, but was unable to run the acore.sh script to build the docker containers as synology uses 7zip, and acore.sh threw an error because it couldn't unzip the archives.
I wondered if it was possible for me to find out what scripts were attempting to unzip things, and change the commands to call 7z?
running acore.sh throws an error because it can't find unzip. however synology use 7zip.
user#DS920:/volume1/docker/wow/azerothcore-wotlk$ ./acore.sh docker build NOTICE: file </volume1/docker/wow/azerothcore-wotlk/conf/config.sh> not found, we use default configuration only. Deno version check: /volume1/docker/wow/azerothcore-wotlk/apps/bash_shared/deno.sh: line 18: ./deps/deno/bin/deno: No such file or directory Installing Deno... Error: unzip is required to install Deno (see: https://github.com/denoland/deno_install#unzip-is-required).
The error message points to /volume1/docker/wow/azerothcore-wotlk/apps/bash_shared/deno.sh and says
Error: unzip is required to install Deno
If you look into deno.sh script you'll see the command which installs deno:
curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL="$AC_PATH_DEPS/deno" sh
If you download this script you'll see unzip there.
I would suggest trying to install unzip, e.g. like described here: How to install IPKG on Synology NAS
You can bypass the ./acore.sh dashboard with standard docker commands.
to build:
$ docker compose --profile app build
to run:
$ docker compose --profile app up # -d for background
Using standard docker commands has the added side benefit of not needing to install deno locally since it's already being installed to the container.
Have your tried:
sudo opkg install unzip
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
I'm building a docker image which also involves a small yum install. I'm currently in a location where firewall's and access controls makes docker pull, yum install etc extremely slow.
In my case, its a JRE8 docker image using this official image script
My problem:
Building the image requires just 2 libraries (gzip + tar) which combined is only of (132 kB + 865 kB). But the yum inside docker build script will first download the repo information which is over 80 MB. While 80 MB is generally small, here, this took over 1 hour just to download. If my colleagues need to build, this would be sheer waste of productive time, not to mention frustration.
Workarounds I'm aware of:
Since this image may not need the full yum power, I can simply grab the *.rpm files, COPY in container script and use rpm -i instead of yum
I can save the built image and locally distribute
I could also find closest mirror for docker-hub, but not yum
My bet:
I've copy of the linux CD with about the same version
I can add commands in dockerfile to rename the *.repo to *.repo.old
Add a cdrom.repo in /etc/yum.repos.d/ inside the container
Use yum to load most common libraries from the CDROM instead of internet
My problem:
I'm not able to make out how to create a mount point to a cdrom repo from inside the container build without using httpd.
In plain linux I do this:
mkdir /cdrom
mount /dev/cdrom /cdrom
cat > /etc/yum.repos.d/cdrom.repo <<EOF
[cdrom]
name=CDROM Repo
baseurl=file:///cdrom
enabled=1
gpgcheck=1
gpgkey=file:///cdrom/RPM-GPG-KEY-oracle
EOF
Any help appreciated.
Docker containers cannot access host devices. I think you will have to write a wrapper script around the docker build command to do the following
First mount the CD ROM to a directory within the docker context ( that would be a sub-directory where your DockerFile exists).
call docker build command using contents from this directory
Un-mount the CD ROM.
so,
cd docker_build_dir
mkdir cdrom
mount /dev/cdrom cdrom
docker build "$#" .
umount cdrom
In the DockerFile, you would simple do this:
RUN cd cdrom && rpm -ivh rpms_you_need
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.
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.