Install CentOS 7 and Docker on VirtualBox

Prasad Jayasinghe
3 min readApr 30, 2020

--

Download and install VirtualBox from its official website, and make sure that you had downloaded the latest version.

Also download the official CentOS ISO from the official website, the latest CentOS build is 7.

Run your VirtualBox after you had installed it on your computer and located its icon on the desktop and click on “New“.

Give your new OS name and set your RAM memory, and also select the version to be “Red Hat (64-bit).

On the Hard Disk step, select “Create a virtual hard drive now” and then click Create.

Select VDI “VirtualBox Disk Image” and click Next, and then select “Dynamically allocated” and click Next then Create.

From the Setting click on Storage, and then add the ISO file to the optical drive to install the operating system.

You had successfully configured your CentOS well, power on your virtual machine by clicking on Start.

From the boot menu select “Install CentOS Linux 7” and press Enter.

Select your language and press on Continue.

Setup your time settings, location, network, and then click “Begin Installation”.

During the installation, you set the root and the user account.

After the installation is completed, press on Reboot.

Now you have successfully installed the CentOS 7 on Virtual Box.

Install Docker on CentOS

There are couple of methods to install Docker in Linux distribution. Here I have selected install form repository method. Because it is much easy way to install docker into your Virtual Box.

  1. Enable the network

# sed -i ‘s/ONBOOT=no/ONBOOT=yes/’ /etc/sysconfig/network-scripts/ifcfg-enp0s3

  1. Start the network service

# systemctl start network

  1. We will update our CentOS.

# yum update -y

  1. Add docker repository

# yum install -y yum-utils

# yum-config-manager — add-repo https://download.docker.com/linux/centos/docker-ce.repo

  1. Update the repository

# yum-config-manager — enable docker-ce-nightly

# yum-config-manager — enable docker-ce-test

  1. Install Docker engine

# yum install docker-ce docker-ce-cli containerd.io

  1. Start docker engine

#systemctl start docker

#systemctl enable docker

  1. Run your 1st docker container

# docker run hello-world

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

--

--

Prasad Jayasinghe
Prasad Jayasinghe

Written by Prasad Jayasinghe

I’m a person who interested in Technology…

Responses (2)

Write a response