Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and uninstall DockerCE in CentOS7

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

How to install and uninstall DockerCE in CentOS7? I believe that most people do not know how to install and uninstall, in order to let you learn, to give you a summary of the following, do not say much, let's look down together.

Clean up the old version of docker before installation

The old version of Docker is called docker or docker-engine.

Sudo yum remove docker\ docker-client\ docker-client-latest\ docker-common\ docker-latest\ docker-latest-logrotate\ docker-logrotate\ docker- II. Use repository for installation

This kind of installation is relatively simple, and the upgrade is convenient.

1. Install dependencies

Before installing Docker CE, you need to install dependencies: the yum-config-manager tools provided by yum-utils, as well as the device-mapper-persistent-data and lvm2 required by devicemapper.

Sudo yum install-y yum-utils\ device-mapper-persistent-data\ lvm22. Install the stable version of repositorysudo yum-config-manager\-add-repo\ https://download.docker.com/linux/centos/docker-ce.repo

Attachment: the commands to enable or disable nightly and test versions are as follows

Sudo yum-config-manager-enable docker-ce-nightlysudo yum-config-manager-enable docker-ce-testsudo yum-config-manager-disable docker-ce-nightlysudo yum-config-manager-disable docker-ce-test

Note: to speed up the installation of yum, we can use Aliyun's source.

Sudo yum-config-manager-- add-repo\ https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo3. Install Docker CEsudo yum install docker-ce docker-ce-cli containerd.io

After the command is executed, the highest version of Docker CE in repository is installed by default. After Docker CE is installed, a docker user group is added, but there are no users in this group.

Attached: install the specified version of Docker CE

a. Execute the following command to list all versions of Docker CE that repository contains

Yum list docker-ce--showduplicates | sort-rdocker-ce.x86_64 3VR 18.09.1-3.el7 docker-ce-stabledocker-ce.x86_64 3VR 18.09.0-3.el7 docker-ce-stabledocker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stabledocker-ce.x86_64 18.06.0.ce -3.el7 docker-ce-stable

b. Execute the following command to install the specified version of Docker CE

Sudo yum install docker-ce- docker-ce-cli- containerd.io4. Start the docker service sudo systemctl start docker5. Run hello-world to verify that docker-ce has been correctly installed with sudo docker run hello-world6. Upgrade Docker CE

Refer to installing the specified version of Docker CE, select the desired version, and yum upgrade.

Third, install Docker CE using rpm package

Download the required version of the Docker CE rpm package and transfer it to the system for installation. To install nightly and test versions, replace the stable in the link with nightly and test. We can also use third-party sources such as Aliyun to download the rpm package.

Use convenience script to install

For development testing only, not for production environments. Pay attention to the following points before use:

The script requires permission from root or sudo. Please review the script before running it. The script automatically detects the release and version of the system. The script cannot customize the installation parameters. The script will automatically install all dependent and recommended installation packages and will not notify you for confirmation. The script does not provide an option for you to choose which version to install, it automatically installs the latest version in edge channel. If you have already installed docker in another way, do not use the convenience script to install it.

The following is an example of installing the latest version of Docker CE in get.docker.com. To install the latest version of test.docker.com, replace each get that appears in the following command with test.

Curl-fsSL https://get.docker.com-o get-docker.shsudo sh get-docker.sh

If you want to use a non-root account to use docker, please add a non-root account to the docker group.

Sudo usermod-aG docker your-user

If you use the convenience script to install, you should be careful not to run the convenience script again to upgrade, which can cause some problems. If you need to upgrade, please use the system's package management tool directly.

5. Uninstall Docker CE

1. Uninstall the package

Sudo yum remove docker-ce

2. Images, containers, volumes, configuration files and other data will not be deleted automatically. Delete images, containers, volumes manually by executing the following command:

Sudo rm-rf / var/lib/docker

3. Any configuration files you have modified needs to be deleted manually.

After reading this article, have you learned to install and uninstall DockerCE in CentOS7? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report