Docker series: 1. Install Docker
Published in
2 min readOct 5, 2019
Keep calm and trust docker documentation.
https://docs.docker.com/install/linux/docker-ce/centos/#prerequisites
Step 1. SET UP THE REPOSITORY
- Install the required packages.
yum-utils
provides theyum-config-manager
utility, anddevice-mapper-persistent-data
andlvm2
are required by thedevicemapper
storage driver. - Use the following command to set up a stable repository.
[vagrant@machine1 ~]$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2[vagrant@machine1 ~]$ sudo yum-config-manager \
-- add-repo \
https://download.docker.com/linux/centos/docker-ce.repoLoaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[vagrant@machine1 ~]$
Step 2. INSTALL DOCKER CE
- Install the latest version of Docker CE and containerd, or go to the next step to install a specific version:
$ sudo yum install docker-ce docker-ce-cli containerd.io
2. Start Docker.
$ sudo systemctl start docker
3. Verify that Docker CE is installed correctly by running the hello-world
image.
[vagrant@machine1 ~]$ sudo docker run hello-worldHello from Docker!
This message shows that your installation appears to be working correctly.
One more test to get Ubuntu image in your docker on Centos
vagrant@machine1 ~]$ sudo docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
5b7339215d1d: Pull complete
14ca88e9f672: Pull complete
a31c3b1caad4: Pull complete
b054a26005b7: Pull complete
Digest: sha256:9b1702dcfe32c873a770a32cfd306dd7fc1c4fd134adfb783db68defc8894b3c
Status: Downloaded newer image for ubuntu:latest
root@2e87bdd8fefe:/#root@2e87bdd8fefe:/# uname -r
3.10.0-957.1.3.el7.x86_64oot@2e87bdd8fefe:/# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
root@2e87bdd8fefe:/#
Issues: Unable to download packages.
Use command yum clean all; yum repolist to download packages.
$yum clean all$yum repolist
Series next read;
https://medium.com/cloudscoop/cloudscoop-docker-create-first-container-c37e254cb091