How to install docker ce(Community Edition) or upgrade docker-ce on CentOS
How to install docker ce(Community Edition) or upgrade docker-ce
1. Uninstall Old Docker Versions if installed.
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
> The Docker CE package is now called docker-ce.
2. Install the Pre-requisites
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
3. Add the Repository.device-mapper-persistent-data \
lvm2
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
4. Install the Docker CE. This will install highest possible Docker Stable packages.
yum install docker-ce docker-ce-cli containerd.io
5. To install a Specific Docker Package Please Follow Following steps.
yum list docker-ce --showduplicates | sort -r
[root@ubuntu ~]# yum list docker-ce --showduplicates | sort -r
Loaded plugins: product-id, search-disabled-repos, subscription-manager
Installed Packages
docker-ce.x86_64 3:18.09.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
6. Now specify the Docker Specific version to Install.Loaded plugins: product-id, search-disabled-repos, subscription-manager
Installed Packages
docker-ce.x86_64 3:18.09.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
7. Docker is installed but not started. The docker group is created, but no users are added to the group. Now Start docker.
systemctl start docker
8. Now Test docker.
docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
[root@iam ~]# docker version
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:08:18 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:10:42 2018
OS/Arch: linux/amd64
Experimental: false
[root@iam ~]#
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:08:18 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:10:42 2018
OS/Arch: linux/amd64
Experimental: false
[root@iam ~]#
9. Enable it to Run time.
[root@server-~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@server ~]#
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@server ~]#
Install using the convenience script
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with something like:sh get-docker.sh
usermod -aG docker your-user
UPGRADE DOCKER CE
To upgrade Docker CE, download the newer package file and repeat the above installation procedure, using yum -y upgrade , and pointing to the new file.Uninstall Docker CE
Uninstall the Docker package:
yum remove docker-ce
Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:
rm -rf /var/lib/docker
You must delete any edited configuration files manually.This document has been written with Reference from Docker Official website.
No comments