11---
22description : Learn how to install Docker Engine on CentOS. These instructions cover
33 the different installation methods, how to uninstall, and next steps.
4- keywords : requirements, yum, installation, centos, install, uninstall, docker engine, upgrade, update
4+ keywords : requirements, dnf, yum, installation, centos, install, uninstall, docker engine, upgrade, update
55title : Install Docker Engine on CentOS
66linkTitle : CentOS
77weight : 60
@@ -36,12 +36,14 @@ default. If you have disabled it, you need to re-enable it.
3636
3737### Uninstall old versions
3838
39- Older versions of Docker went by ` docker ` or ` docker-engine ` .
40- Uninstall any such older versions before attempting to install a new version,
41- along with associated dependencies.
39+ Before you can install Docker Engine, you need to uninstall any conflicting packages.
40+
41+ Your Linux distribution may provide unofficial Docker packages, which may conflict
42+ with the official packages provided by Docker. You must uninstall these packages
43+ before you install the official version of Docker Engine.
4244
4345``` console
44- $ sudo yum remove docker \
46+ $ sudo dnf remove docker \
4547 docker-client \
4648 docker-client-latest \
4749 docker-common \
@@ -51,7 +53,7 @@ $ sudo yum remove docker \
5153 docker-engine
5254```
5355
54- ` yum ` might report that you have none of these packages installed.
56+ ` dnf ` might report that you have none of these packages installed.
5557
5658Images, containers, volumes, and networks stored in ` /var/lib/docker/ ` aren't
5759automatically removed when you uninstall Docker.
@@ -81,25 +83,25 @@ Docker from the repository.
8183
8284#### Set up the repository
8385
84- Install the ` yum-utils ` package (which provides the ` yum-config-manager `
85- utility ) and set up the repository.
86+ Install the ` dnf-plugins-core ` package (which provides the commands to manage
87+ your DNF repositories ) and set up the repository.
8688
8789``` console
88- $ sudo yum install -y yum-utils
89- $ sudo yum- config-manager --add-repo {{% param " download-url-base" %}}/docker-ce.repo
90+ $ sudo dnf -y install dnf-plugins-core
91+ $ sudo dnf config-manager --add-repo {{% param " download-url-base" %}}/docker-ce.repo
9092```
9193
9294#### Install Docker Engine
9395
94- 1 . Install Docker Engine, containerd, and Docker Compose:
96+ 1 . Install the Docker packages.
9597
9698 {{< tabs >}}
9799 {{< tab name="Latest" >}}
98100
99101 To install the latest version, run:
100102
101103 ``` console
102- $ sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
104+ $ sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
103105 ```
104106
105107 If prompted to accept the GPG key, verify that the fingerprint matches
@@ -115,7 +117,7 @@ $ sudo yum-config-manager --add-repo {{% param "download-url-base" %}}/docker-ce
115117 the repository:
116118
117119 ``` console
118- $ yum list docker-ce --showduplicates | sort -r
120+ $ dnf list docker-ce --showduplicates | sort -r
119121
120122 docker-ce.x86_64 3:27.3.1-1.el9 docker-ce-stable
121123 docker-ce.x86_64 3:27.3.0-1.el9 docker-ce-stable
@@ -133,7 +135,7 @@ $ sudo yum-config-manager --add-repo {{% param "download-url-base" %}}/docker-ce
133135 command to install:
134136
135137 ``` console
136- $ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-buildx-plugin docker-compose-plugin
138+ $ sudo dnf install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-buildx-plugin docker-compose-plugin
137139 ```
138140
139141 This command installs Docker, but it doesn't start Docker. It also creates a
@@ -142,7 +144,7 @@ $ sudo yum-config-manager --add-repo {{% param "download-url-base" %}}/docker-ce
142144 {{< /tab >}}
143145 {{< /tabs >}}
144146
145- 2 . Start Docker.
147+ 2 . Start Docker Engine .
146148
147149 ``` console
148150 $ sudo systemctl enable --now docker
@@ -152,8 +154,7 @@ $ sudo yum-config-manager --add-repo {{% param "download-url-base" %}}/docker-ce
152154 boot your system. If you don't want Docker to start automatically, use `sudo
153155 systemctl start docker` instead.
154156
155- 3 . Verify that the Docker Engine installation is successful by running the
156- ` hello-world ` image.
157+ 3 . Verify that the installation is successful by running the ` hello-world ` image:
157158
158159 ``` console
159160 $ sudo docker run hello-world
@@ -186,20 +187,23 @@ download a new file each time you want to upgrade Docker Engine.
186187 the Docker package.
187188
188189 ``` console
189- $ sudo yum install /path/to/package.rpm
190+ $ sudo dnf install /path/to/package.rpm
190191 ```
191192
192193 Docker is installed but not started. The ` docker ` group is created, but no
193194 users are added to the group.
194195
195- 3 . Start Docker.
196+ 3 . Start Docker Engine .
196197
197198 ``` console
198- $ sudo systemctl start docker
199+ $ sudo systemctl enable --now docker
199200 ```
200201
201- 4 . Verify that the Docker Engine installation is successful by running the
202- ` hello-world ` image.
202+ This configures the Docker systemd service to start automatically when you
203+ boot your system. If you don't want Docker to start automatically, use `sudo
204+ systemctl start docker` instead.
205+
206+ 4 . Verify that the installation is successful by running the ` hello-world ` image:
203207
204208 ``` console
205209 $ sudo docker run hello-world
@@ -215,8 +219,8 @@ You have now successfully installed and started Docker Engine.
215219#### Upgrade Docker Engine
216220
217221To upgrade Docker Engine, download the newer package files and repeat the
218- [ installation procedure] ( #install-from-a-package ) , using ` yum -y upgrade`
219- instead of ` yum -y install` , and point to the new files.
222+ [ installation procedure] ( #install-from-a-package ) , using ` dnf upgrade`
223+ instead of ` dnf install` , and point to the new files.
220224
221225{{< include "install-script.md" >}}
222226
@@ -225,7 +229,7 @@ instead of `yum -y install`, and point to the new files.
2252291 . Uninstall the Docker Engine, CLI, containerd, and Docker Compose packages:
226230
227231 ``` console
228- $ sudo yum remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
232+ $ sudo dnf remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
229233 ```
230234
2312352 . Images, containers, volumes, or custom configuration files on your host
0 commit comments