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

31.9k views Asked by At

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+

3

There are 3 answers

4
Yash Jagdale On BEST ANSWER

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

0
Naramsim On

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
0
MohammadReza On

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.