Docker Offline Installation

SEVCAN OZDEMIR
4 min readOct 4, 2022

Hello everyone,

Although Docker delivers some level of security, containers themselves do not provide all necessary security measures. For many organizations security is a big issue when dealing with open-source tools. This is why many organizations do not work with servers that are open to the internet.

In this article, I will talk about how docker is installed on my offline CentOS7 machine and how the image is created.

I have two CentOS7 machines and one can access the internet while the other cannot.

.Online Machine

-First I connect to my online machine as root. Docker CE requires some software packages that are available in EPEL (Extra Packages for Enterprise Linux) yum repository. Therefore, we have to install EPEL yum repository first.

-Install Docker CE yum repository on our CentOS 7 operating system.

-Enable Docker CE (Nightly) yum repository.

-We have added two yum repositories in our Linux server. Therefore, we should build cache for yum package manager.

-Create a directory to download Docker CE and dependent software packages. Then change to this directory.

-Download Docker CE and dependent packages following Linux command.

-We can check that the packages are downloaded.

-Now we will send these packages to our offline machine. Therefore, we are creating a tarball of all downloaded software packages.

-We have a tarball of Docker CE and dependent software packages.

.Offline Machine

-Transfer the docker.tar.gz tarball to offline machine and copy at home directory of root user. See it copied.

-Extract the docker.tar.gz tarball.

#mkdir docker

# tar xf docker.tar.gz -C ~/docker

-Install all packages in the ~/docker directory.

-Start and enable Docker service.

-We can check that the service is active.

Download Docker Images From Docker Hub

Since, our Linux server is not connected to Internet, therefore, we cannot pull Docker images directly from Docker Hub.The workaround of this problem is to download Docker images on an online system and then transfer and load these images to our offline CentOS 7 server.

.Online Machine

-We pull hello-world image from docker hub

# docker pull hello-world

-We pull hello-world image from docker hub. Then we check that the image is loaded.

-Save hello-world image in a tar file.

-Transfer hello-world to offline machine.

.Offline Machine

-Load hello-world image by using docker command.We see that the Hello-world image is created.

-After creating the image, we create a container from the hello-world image.

Now our container is ready :)

See you in my next post..

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response