{"id":6252,"date":"2020-06-28T10:19:52","date_gmt":"2020-06-28T07:19:52","guid":{"rendered":"https:\/\/kifarunix.com\/?p=6252"},"modified":"2024-03-14T21:11:42","modified_gmt":"2024-03-14T18:11:42","slug":"install-and-use-docker-ce-on-centos-8","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-use-docker-ce-on-centos-8\/","title":{"rendered":"Install and Use Docker CE on CentOS 8"},"content":{"rendered":"\n<p>Welcome to our guide on how to install and use docker ce on CentOS 8. <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.docker.com\/get-started\/\" target=\"_blank\">Docker<\/a>&nbsp;is a platform that enables developers and system administrators to&nbsp;<strong>build, run, and share<\/strong>&nbsp;applications with containers.<\/p>\n\n\n\n<p>The exits two editions of docker available.&nbsp;<code>Docker CE<\/code>&nbsp;and&nbsp;<code>Docker EE<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Docker CE (Community Edition) is the open-source, community supported version of Docker and is available for free.<\/li>\n\n\n\n<li>Docker EE (Enterprise Edition) is a commercial\/premium version of Docker CE and is supported by Docker Inc.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installdockerce\"><a href=\"#installdockerce\">Installing Docker CE on CentOS 8<\/a><\/h2>\n\n\n\n<p>There are different methods in which you can install Docker CE on CentOS 8;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#installdockerfromrepos\">Installing Docker CE on from Docker Repositories<\/a><\/li>\n\n\n\n<li><a href=\"#installdockercefromrpm\">Installing Docker CE manually on using the RPM binary package<\/a><\/li>\n\n\n\n<li>Installing Docker CE using Docker Installation Script (<strong>Beyond the scope of this tutorial<\/strong>).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"installdockerfromrepos\">Installing Docker CE from Docker Repositories<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Run System Update<\/h4>\n\n\n\n<p>Ensure that your system package cache is up-to-date.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf update<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Uninstall Docker Versions<\/h4>\n\n\n\n<p>If any of the old docker versions are installed on your system, ensure that you remove them and their dependencies before you proceed.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf remove docker*<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Install Docker CE Repository on CentOS 8<\/h4>\n\n\n\n<p>To ensure seamless future upgrades of Docker packages, you can install it from their official repos. For this, you need to setup the Docker repositories on CentOS 8 by executing the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf config-manager --add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo<\/code><\/pre>\n\n\n\n<p>The command above installs and enable Docker CE repo on CentOS 8.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Install Docker Engine (Docker CE) on CentOS 8<\/h4>\n\n\n\n<p>Once the repos are in place, proceed to install docker-ce and other tools including&nbsp;<code>containerd.io<\/code>, an open and reliable container runtime on CentOS 8.<\/p>\n\n\n\n<p>Next, install Docker CE and Docker CE CLI utility.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install docker-ce docker-ce-cli containerd.io<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"installdockercefromrpm\">Installing Docker CE from an RPM package<\/h3>\n\n\n\n<p>You can as well install Docker ce on CentOS 8 using an RPM package.<\/p>\n\n\n\n<p>Download the latest versions of the individual packages installed above from <a href=\"https:\/\/download.docker.com\/linux\/centos\/8\/x86_64\/stable\/Packages\/\" target=\"_blank\" rel=\"noreferrer noopener\">Docker Packages page<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>for i in containerd.io-1.4.6-3.1.el8.x86_64.rpm docker-ce-20.10.7-3.el8.x86_64.rpm docker-ce-cli-20.10.7-3.el8.x86_64.rpm; do dnf install -y <a href=\"https:\/\/download.docker.com\/linux\/centos\/7\/x86_64\/stable\/Packages\/\" target=\"_blank\" rel=\"noopener\">https:\/\/download.docker.com\/linux\/centos\/8\/x86_64\/stable\/Packages\/<\/a>$i; done<\/code><\/pre>\n\n\n\n<p>Replace the version\/release numbers of the packages accordingly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Starting Docker Service<\/h3>\n\n\n\n<p>To start and enable Docker and Containerd service to run on system boot;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl enable --now docker containerd<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"rundockerasnonrootuser\"><a href=\"#rundockerasnonrootuser\">Running Docker as a non-root user<\/a><\/h3>\n\n\n\n<p>If you run Docker as standard user, you may get such an error;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>[koromicha@centos8 ~]$ docker ps -a<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>docker: Got permission denied while trying to connect to the Docker daemon socket at unix:\/\/\/var\/run\/docker.sock: <strong>...<\/strong>\n\/var\/run\/docker.sock: connect: permission denied.\nSee 'docker run --help'.<\/code><\/pre>\n\n\n\n<p>Therefore, if you need to run docker as non-root user, simply add the user you want to run docker as to docker group or simply, grant the user sudo rights. For example to add a user,&nbsp;<code>koromicha<\/code>, to&nbsp;<code>docker<\/code>&nbsp;group;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>usermod -aG docker koromicha<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>groups koromicha<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>koromicha : koromicha <strong>docker<\/strong><\/code><\/pre>\n\n\n\n<p><strong>Next, log out and login again as the non root user that you added to the docker group so that your group membership can be re-evaluated<\/strong>.<\/p>\n\n\n\n<p>You can then run docker as a non root user.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Verifying Docker CE installation<\/h3>\n\n\n\n<p>Check the docker version;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker --version<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>Docker version 19.03.12, build 48a66213fe<\/code><\/pre>\n\n\n\n<p>To verify that Docker CE is running well, you can try running the&nbsp;<code>hello-world<\/code>&nbsp;container image.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>[koromicha@centos8 ~]$ <strong>docker run hello-world<\/strong><\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>Unable to find image 'hello-world:latest' locally\nlatest: Pulling from library\/hello-world\n0e03bdcc26d7: Pull complete \nDigest: sha256:8e3114318a995a1ee497790535e7b88365222a21771ae7e53687ad76563e8e76\nStatus: Downloaded newer image for hello-world:latest\n\nHello from Docker!\nThis message shows that your installation appears to be working correctly.\n\nTo generate this message, Docker took the following steps:\n 1. The Docker client contacted the Docker daemon.\n 2. The Docker daemon pulled the \"hello-world\" image from the Docker Hub.\n    (amd64)\n 3. The Docker daemon created a new container from that image which runs the\n    executable that produces the output you are currently reading.\n 4. The Docker daemon streamed that output to the Docker client, which sent it\n    to your terminal.\n\nTo try something more ambitious, you can run an Ubuntu container with:\n $ docker run -it ubuntu bash\n\nShare images, automate workflows, and more with a free Docker ID:\n https:\/\/hub.docker.com\/\n\nFor more examples and ideas, visit:\n https:\/\/docs.docker.com\/get-started\/\n<\/code><\/pre>\n\n\n\n<p>To list running containers;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>[koromicha@centos8 ~]$ <strong>docker ps -a<\/strong><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES\n4083300e3660        hello-world         \"\/hello\"            3 minutes ago       Exited (0) 5 minutes ago                       laughing_visvesvaraya<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"rundockerimagescentos8\"><a href=\"#rundockerimagescentos8\">Running Docker Images on CentOS 8<\/a><\/h2>\n\n\n\n<p>While verifying docker installation above, we ran the hello-world docker container image. Building and running docker containerized applications is the next step after setting up your docker environment.<\/p>\n\n\n\n<p>So there are two things here: You can either build and run your own docker container images or pull already created and shared images from <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/hub.docker.com\/search?type=edition&amp;offering=community\" target=\"_blank\" rel=\"noreferrer noopener\">docker hub<\/a>, an image repository for Docker images.<\/p>\n\n\n\n<p>In this demo, we will learn how to use already created docker images from docker hub. With docker command, you can easily pull docker images from docker hub, as we did with the <strong>hello-world<\/strong> image above.<\/p>\n\n\n\n<p>If you want to build your own images and share on docker hub, then you need to sign up to create your own namespace for storing your images, which then can be publicly available.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"usingdockercommand\"><a href=\"#usingdockercommand\">Using <code>docker<\/code> command<\/a><\/h3>\n\n\n\n<p><code>docker<\/code> command has quite a number of command line options for running various tasks.<\/p>\n\n\n\n<p>The command line syntax is;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker [OPTIONS] COMMAND<\/code><\/pre>\n\n\n\n<p>You can view various command options and commands by executing;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker --help<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>...\nOptions:\n      --config string      Location of client config files (default \"\/home\/koromicha\/.docker\")\n  -c, --context string     Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with \"docker context use\")\n  -D, --debug              Enable debug mode\n...\nManagement Commands:\n  builder     Manage builds\n  config      Manage Docker configs\n  container   Manage containers\n...\nCommands:\n  attach      Attach local standard input, output, and error streams to a running container\n  build       Build an image from a Dockerfile\n  commit      Create a new image from a container's changes\n  cp          Copy files\/folders between a container and the local filesystem\n  create      Create a new container\n...\n<\/code><\/pre>\n\n\n\n<p>To view help for a specific docker command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker COMMAND --help<\/code><\/pre>\n\n\n\n<p>For example, to find the usage of docker <code>run<\/code> command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker run --help<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"usingdockerhubimages\"><a href=\"#usingdockerhubimages\">Running Docker Images from Docker Hub<\/a><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"dockersearch\"><a href=\"#dockersearch\">Searching for Docker Images on Docker Hub<\/a><\/h4>\n\n\n\n<p>You can search for the specific publicly available Docker images on Docker Hub using <code><strong>docker search<\/strong><\/code> command. The docker search command syntax is;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker search [OPTIONS] TERM<\/code><\/pre>\n\n\n\n<p>Use <strong><code>docker search --help<\/code><\/strong> to see more options.<\/p>\n\n\n\n<p>For example, to search all the images containing the term hello-world;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker search hello-world<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>NAME                                       DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED\nhello-world                                Hello World! (an example of minimal Dockeriz\u2026   1226                [OK]                \nkitematic\/hello-world-nginx                A light-weight nginx container that demonstr\u2026   147                                     \ntutum\/hello-world                          Image to test docker deployments. Has Apache\u2026   72                                      [OK]\ndockercloud\/hello-world                    Hello World!                                    19                                      [OK]\n...\n<\/code><\/pre>\n\n\n\n<p>Some column headings are self explanatory. Other columns include;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>STARS<\/strong>&nbsp;: Shows the number of likes the image has had.<\/li>\n\n\n\n<li><strong>OFFICIAL<\/strong>&nbsp;: Specifies whether the image is built from a trusted source.<\/li>\n\n\n\n<li><strong>AUTOMATED<\/strong>&nbsp;: Shows whether the image has been&nbsp;automatically build from source code in an external repository and automatically pushed to Docker repositories.<\/li>\n<\/ul>\n\n\n\n<p>Usually, an image with no prefix is considered official docker hub image, stable and being maintained. It also contains <strong>[OK]<\/strong> on the <strong>Official<\/strong> column.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"dockerpull\"><a href=\"#dockerpull\">Pulling Docker Image to Local Registry<\/a><\/h4>\n\n\n\n<p>Once you have identified the image that you need to run, you can either pull it and store it on your local registry using the the <code><strong>docker pull<\/strong><\/code> command or simply run it using <code><strong>docker run<\/strong><\/code> command.<\/p>\n\n\n\n<p>For example, to search and pull an<a href=\"https:\/\/hub.docker.com\/_\/ubuntu\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\"> Ubuntu system docker image<\/a>;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker search ubuntu<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>NAME                                                      DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED\nubuntu                                                    Ubuntu is a Debian-based Linux operating sys\u2026   11046               [OK]                \ndorowu\/ubuntu-desktop-lxde-vnc                            Docker image to provide HTML5 VNC interface \u2026   441                                     [OK]\nrastasheep\/ubuntu-sshd\n...\n<\/code><\/pre>\n\n\n\n<p>Let us pull the official Ubuntu image.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker pull ubuntu<\/code><\/pre>\n\n\n\n<p>This will by default pull the most recent version of Ubuntu currently available, usually the latest LTS versions.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>Using default tag: latest\nlatest: Pulling from library\/ubuntu\na4a2a29f9ba4: Pull complete \n127c9761dcba: Pull complete \nd13bf203e905: Pull complete \n4039240d2e0b: Pull complete \nDigest: sha256:35c4a2c15539c6c1e4e5fa4e554dac323ad0107d8eb5c582d6ff386b383b7dce\nStatus: Downloaded newer image for ubuntu:latest\ndocker.io\/library\/ubuntu:latest\n<\/code><\/pre>\n\n\n\n<p>You can specify other tags for specific types of Ubuntu though;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker search ubuntu:20.04<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"listdockerimages\"><a href=\"#listdockerimages\">List Available Docker Images<\/a><\/h4>\n\n\n\n<p>You can list locally available images using <code>docker images<\/code> command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker images<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE\nubuntu              latest              74435f89ab78        11 days ago         73.9MB\nhello-world         latest              bf756fb1ae65        5 months ago        13.3kB<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"dockerrunimage\"><a href=\"#dockerrunimage\">Running a Docker Container Image<\/a><\/h4>\n\n\n\n<p>Once you have pulled a container from Docker hub and is available locally, you can either run it with <code>docker run<\/code> or <code>docker create<\/code> command.<\/p>\n\n\n\n<p>With <code>docker run<\/code>, you can create a container, start it and access it using a shell to run any command inside it. The docker run command line syntax is;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG\u2026]<\/code><\/pre>\n\n\n\n<p> For example, to run our Ubuntu image we pulled from Docker hub above in an interactive manner (<strong>option -i<\/strong>) drop to the shell (<strong>option -t<\/strong>, to allocate pseudo-TTY);<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker run -it ubuntu<\/code><\/pre>\n\n\n\n<p>This drops to the shell;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>root@43ff7a031a0b:\/#<\/code><\/pre>\n\n\n\n<p>You are now inside an Ubuntu container, with a container ID, <strong>43ff7a031a0b<\/strong>, as root user. Anything that you run or execute under this shell happens within the filesystem of the container itself.<\/p>\n\n\n\n<p>You can execute the commands directly without dropping to container shell;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker run ubuntu cat \/etc\/os-release<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>NAME=\"Ubuntu\"\nVERSION=\"20.04 LTS (Focal Fossa)\"\nID=ubuntu\nID_LIKE=debian\nPRETTY_NAME=\"Ubuntu 20.04 LTS\"\nVERSION_ID=\"20.04\"\nHOME_URL=\"https:\/\/www.ubuntu.com\/\"\nSUPPORT_URL=\"https:\/\/help.ubuntu.com\/\"\nBUG_REPORT_URL=\"https:\/\/bugs.launchpad.net\/ubuntu\/\"\nPRIVACY_POLICY_URL=\"https:\/\/www.ubuntu.com\/legal\/terms-and-policies\/privacy-policy\"\nVERSION_CODENAME=focal\nUBUNTU_CODENAME=focal\n<\/code><\/pre>\n\n\n\n<p>If you run the container interactively and started a shell, you can run your commands inside it.<\/p>\n\n\n\n<p>When you exit the shell, the shell attached to the container is detached and container stops. If you used the options, -i and -t when running docker container, you can exit the shell without stopping the container, use the keystrokes <code><strong>Ctrl + p<\/strong><\/code> then <code><strong>Ctrl + q<\/strong><\/code>.<\/p>\n\n\n\n<p>You can as well run container in background and print container ID<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker run -dit --name ubuntudemo ubuntu<\/code><\/pre>\n\n\n\n<p>To attach it to the console;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker attach ubuntudemo<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"listdockercontainers\"><a href=\"#listdockercontainers\">Listing Docker Containers<\/a><\/h4>\n\n\n\n<p>You can list live (currently running) containers using <code><strong>docker ps<\/strong><\/code> command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker ps<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES\n1c280cf21322        ubuntu              \"\/bin\/bash\"         2 minutes ago       Up 2 minutes                            ubuntudemo<\/code><\/pre>\n\n\n\n<p>To list all containers, those running and those exited;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker ps -a<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>CONTAINER ID        IMAGE               COMMAND                 CREATED             STATUS                        PORTS               NAMES\n1c280cf21322        ubuntu              \"\/bin\/bash\"             3 minutes ago       Up 3 minutes                                      ubuntudemo\nb5453d11a544        ubuntu              \"\/bin\/bash\"             10 minutes ago      Exited (0) 8 minutes ago                          stupefied_hawking\na65d1797c504        ubuntu              \"\/bin\/bash\"             14 minutes ago      Exited (0) 12 minutes ago                         zen_ramanujan\nc4d68a2b1b39        ubuntu              \"\/bin\/bash\"             23 minutes ago      Exited (137) 20 minutes ago                       sweet_dirac\n9b7867c1daad        ubuntu              \"cat \/etc\/os-release\"   40 minutes ago      Exited (0) 40 minutes ago                         great_allen\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"startstopdockercontainer\"><a href=\"#startstopdockercontainer\">Start and Stop Docker Containers<\/a><\/h4>\n\n\n\n<p>You can start exited\/stopped containers using <code><strong>docker start<\/strong><\/code> command. For example, to start container named, <strong>stupefied_hawking<\/strong>, with an ID of <strong>b5453d11a544<\/strong>, run the command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker start <strong>stupefied_hawking<\/strong><\/code><\/pre>\n\n\n\n<p>Or<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker start <strong>b5453d11a544<\/strong><\/code><\/pre>\n\n\n\n<p>Similarly, you can stop a running docker using its name or container ID with <code>docker stop<\/code> command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker stop ubuntudemo<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"removedockercontainer\"><a href=\"#removedockercontainer\">Removing Docker Containers<\/a><\/h4>\n\n\n\n<p>Once you are done with your containers, you can remove them using <code><strong>docker rm<\/strong><\/code> command.<\/p>\n\n\n\n<p>To remove a stopped container with an ID of <strong>9b7867c1daad<\/strong>, for example, in our <code>docker ps -a<\/code> output above;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker rm 9b7867c1daad<\/code><\/pre>\n\n\n\n<p>You cannot remove a running container unless you force the removal using using <code><strong>-f<\/strong><\/code> or <code><strong>--force<\/strong><\/code> option of docker rm command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker rm 1c280cf21322 -f<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"removedockerimages\"><a href=\"#removedockerimages\">Removing Docker Images<\/a><\/h4>\n\n\n\n<p>Docker images can as well be removed using <code>docker rmi<\/code> command. For example, you can list images and get the image ID of the specific image you want to remove;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker images -a<\/code><\/pre>\n\n\n\n<p>You can show numeric IDS using <code><strong>-q<\/strong><\/code> option.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker images -a -q<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>74435f89ab78\nbf756fb1ae65<\/code><\/pre>\n\n\n\n<p>Delete an image;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker rmi 74435f89ab78<\/code><\/pre>\n\n\n\n<p>Or use the name repo name;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>docker rmi ubuntu<\/code><\/pre>\n\n\n\n<p>Use option <code><strong>-f<\/strong><\/code> or <strong><code>--force<\/code><\/strong> to force the deletion.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Further Reading<\/h3>\n\n\n\n<p><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/docker\/\" target=\"_blank\" rel=\"noreferrer noopener\">Docker Documentation<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Related Tutorials<\/h3>\n\n\n\n<p><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-docker-ce-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Docker CE on Ubuntu 20.04<\/a><\/p>\n\n\n\n<p><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-and-use-docker-on-debian-10-buster\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Use Docker on Debian 10 Buster<\/a><\/p>\n\n\n\n<p><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-and-setup-ansible-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Setup Ansible on Ubuntu 20.04<\/a><\/p>\n\n\n\n<p><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-and-deploy-kubernetes-cluster-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Deploy Kubernetes Cluster on Ubuntu 20.04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to our guide on how to install and use docker ce on CentOS 8. Docker&nbsp;is a platform that enables developers and system administrators to&nbsp;build,<\/p>\n","protected":false},"author":1,"featured_media":9718,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,1076,1077],"tags":[1142,1734,1732,1733,1731,1728,1736,1730,1737,1735,1729],"class_list":["post-6252","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-containers","category-docker","tag-centos-8","tag-docker-ce-2","tag-docker-pull","tag-docker-run","tag-docker-search","tag-install-docker-ce-centos-8","tag-list-docker-containers","tag-list-docker-images","tag-remove-docker-containers","tag-remove-docker-images","tag-run-docker-images-on-centos-8","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/6252"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=6252"}],"version-history":[{"count":11,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/6252\/revisions"}],"predecessor-version":[{"id":21413,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/6252\/revisions\/21413"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/9718"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=6252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=6252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=6252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}