{"id":222,"date":"2023-01-23T09:07:06","date_gmt":"2023-01-23T09:07:06","guid":{"rendered":"https:\/\/www.dedicatedcore.com\/blog\/?p=222"},"modified":"2024-11-08T11:02:50","modified_gmt":"2024-11-08T11:02:50","slug":"install-docker-ubuntu-linux","status":"publish","type":"post","link":"https:\/\/www.dedicatedcore.com\/blog\/install-docker-ubuntu-linux\/","title":{"rendered":"How to Install Docker on Ubuntu Linux (22.04,23.04)"},"content":{"rendered":"<p>On most other Linux distributions, including Ubuntu 23.04, Docker can be downloaded and installed. Similar to how you would use your distro&#8217;s package management to get an app, you may use Docker to install software packages once it has been installed.<\/p>\n<p>Docker&#8217;s well-known technology allows programmers to create, distribute, and operate applications within containers. These containers offer a remote environment for running applications and are compact and portable. The operating systems Linux, Windows, and macOS all support, Docker. For a seamless software deployment experience, learn how to keep a <a href=\"https:\/\/www.dedicatedcore.com\/blog\/update-docker-image-container\/\" target=\"_blank\" rel=\"noopener\">secure environment<\/a> and up-to-date by updating Docker Image and Container.<\/p>\n<h2>Option 1: How to Install Docker on Ubuntu 22.04, 23.04, 20.04?<\/h2>\n<p>Here you will get to know about how to set up Docker on Ubuntu 18.04, 20.04, 22.04, or 23.04. The installation procedure is simple, and the procedures listed below are simple. Make sure you have sudo privileges on your Ubuntu machine before we start. You&#8217;ll be able to install Docker and issue administrative commands.<\/p>\n<h3>Step 1: First of all, Update your Ubuntu System.<\/h3>\n<p>The first step is to refresh the repositories. To do so, run the command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo apt update<\/pre>\n<p>The above command is used to update the package database on your Ubuntu system. It helps to make sure that the system contains the latest information about available packages or their support.<\/p>\n<h3>Step 2: Before Installing Docker, Install Prerequisite Packages<\/h3>\n<p>A few required packages that enable apt-to-use packages through HTTPS must then be installed. Use the following command to install these packages:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt install apt-transport-https ca-certificates curl software-properties-common -y<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-225\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-prerequisite-packages-docker.png\" alt=\"installing prerequisite packages before docker on ubuntu\" width=\"800\" height=\"391\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-prerequisite-packages-docker.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-prerequisite-packages-docker-300x147.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-prerequisite-packages-docker-150x73.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-prerequisite-packages-docker-768x375.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-prerequisite-packages-docker-100x49.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-prerequisite-packages-docker-700x342.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>The packages required for apt to use an HTTPS repository are installed by this command. It consists of the apt-transport-https package, which enables apt to access repositories using the HTTPS protocol. The ca-certificates package provides SSL\/TLS certificates for validating HTTPS connections. The GnuPG-agent and software-properties-common packages are also installed. The curl command-line tool enables data transfer using several protocols.<\/p>\n<h3>Step 3: Add Docker\u2019s Official GPG key<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add -<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-226\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-gpg-key-verify-package.png\" alt=\"check docker package using gpg key\" width=\"800\" height=\"132\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-gpg-key-verify-package.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-gpg-key-verify-package-300x50.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-gpg-key-verify-package-150x25.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-gpg-key-verify-package-768x127.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-gpg-key-verify-package-100x17.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-gpg-key-verify-package-700x116.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>The official GPG key for Docker is retrieved and added to the system with this command. Prior to installation, the integrity of Docker packages is checked using the key.<\/p>\n<h3>Step 4: Time to Add the Docker Repository<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo add-apt-repository \"deb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-227\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/add-docker-repository-apt.png\" alt=\"view list of software with docker repository command\" width=\"800\" height=\"450\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/add-docker-repository-apt.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/add-docker-repository-apt-300x169.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/add-docker-repository-apt-150x84.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/add-docker-repository-apt-768x432.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/add-docker-repository-apt-100x56.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/add-docker-repository-apt-700x394.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>The Docker repository is added to your system&#8217;s list of software sources with this command. The unclear argument indicates the Ubuntu distribution codename. The repository contains the Docker packages for Ubuntu 22.04. You would use focused instead of hirsute in this command if you are running Ubuntu 20.04.<\/p>\n<h3>Step 5: Here you can Specify the Installation Source<\/h3>\n<p>Run the apt-cache command to verify the source for the Docker installation. It is the Docker repository and not the Ubuntu repository. The apt-cache command searches the apt package manager&#8217;s package cache for the early added Docker packages.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">apt-cache policy docker-ce<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-228\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-apt-cache-command-verify-docker-repository.png\" alt=\"checking docker installation source\" width=\"800\" height=\"339\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-apt-cache-command-verify-docker-repository.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-apt-cache-command-verify-docker-repository-300x127.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-apt-cache-command-verify-docker-repository-150x64.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-apt-cache-command-verify-docker-repository-768x325.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-apt-cache-command-verify-docker-repository-100x42.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-apt-cache-command-verify-docker-repository-700x297.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<h3>Step 6: Finally Install Docker with the Command Below<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt install docker-ce -y<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-229\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-ubuntu-command.png\" alt=\"installation of docker on ubuntu \" width=\"800\" height=\"477\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-ubuntu-command.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-ubuntu-command-300x179.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-ubuntu-command-150x89.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-ubuntu-command-768x458.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-ubuntu-command-100x60.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-ubuntu-command-700x417.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<h3>Step 7: Here you can check the Docker Status<\/h3>\n<p>Check if Docker is installed, the daemon starts, and the process is enabled to start on startup. Run the following command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo systemctl status docker<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-230\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-install-status.png\" alt=\"how to check installed docker status linux\" width=\"800\" height=\"305\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-install-status.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-install-status-300x114.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-install-status-150x57.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-install-status-768x293.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-install-status-100x38.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-install-status-700x267.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<h2>Option 2: Installing Docker from the Default Repositories<\/h2>\n<h3>Step 1: Before Installing, Update the Repository<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt update<\/pre>\n<p>Before you install the docker you need to update the repository with the above command and then the process of installation.<\/p>\n<h3>Step 2: Now you can Install Docker<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt install docker.io -y<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-231\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-default-repository-ubuntu.png\" alt=\"installing docker from default repository\" width=\"800\" height=\"379\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-default-repository-ubuntu.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-default-repository-ubuntu-300x142.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-default-repository-ubuntu-150x71.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-default-repository-ubuntu-768x364.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-default-repository-ubuntu-100x47.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-default-repository-ubuntu-700x332.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>With this command, you can install the docker from the default repositories.<\/p>\n<h3>Step 3: After the Installation of Docker you should Install Dependencies<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo snap install docker<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-232\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-dependencies-package.png\" alt=\"install docker dependency command\" width=\"800\" height=\"137\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-dependencies-package.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-dependencies-package-300x51.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-dependencies-package-150x26.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-dependencies-package-768x132.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-dependencies-package-100x17.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/install-docker-dependencies-package-700x120.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Once the installation is done of docker you should install dependencies with the command given above.<\/p>\n<h3>Step 4: Check the Installation in Final Step<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo systemctl status docker<\/pre>\n<p>At the final stage, you need to check the installation by the command which is shown above for you to make the confirmation. Alternatively, check the program version by running:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">docker --version<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-233\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-version.png\" alt=\"checking docker version installation\" width=\"800\" height=\"112\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-version.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-version-300x42.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-version-150x21.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-version-768x108.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-version-100x14.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/check-docker-version-700x98.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<h3>How to Use Docker on Ubuntu<\/h3>\n<p>Run the docker command in the terminal to access all Docker information, including syntax, options, and commands:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">docker<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-234\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/how-use-docker-ubuntu.png\" alt=\"run a docker command in terminal\" width=\"800\" height=\"397\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/how-use-docker-ubuntu.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/how-use-docker-ubuntu-300x149.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/how-use-docker-ubuntu-150x74.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/how-use-docker-ubuntu-768x381.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/how-use-docker-ubuntu-100x50.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/how-use-docker-ubuntu-700x347.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Downloading Docker images, building containers, and controlling Docker volumes are the first steps in utilizing Docker.<\/p>\n<h3>Working With Docker Images<\/h3>\n<p>The foundation for creating Docker containers is Docker images. The images can be found on Docker Hub, a repository for Docker files. All users can host their images on Docker Hub thanks to the repository, which produces a large selection of images, including Linux distributions and apps. The sections below demonstrate various approaches to using Docker images.<\/p>\n<h3>Lookup Docker Images<\/h3>\n<p>Use the docker search command to look for available images on Docker Hub. As for the syntax:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker search [keyword]<\/pre>\n<p>Enter the search term you want to use for [keyword]. Run: for instance, to display all Ubuntu pictures.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker search ubuntu<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-235\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-images-on-ubuntu.png\" alt=\"search for docker hub images on ubuntu\" width=\"800\" height=\"514\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-images-on-ubuntu.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-images-on-ubuntu-300x193.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-images-on-ubuntu-150x96.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-images-on-ubuntu-768x493.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-images-on-ubuntu-100x64.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/docker-images-on-ubuntu-700x450.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>The result is a list of all photos that contain the keyword &#8220;Ubuntu.&#8221; If the [OK] parameter appears in the OFFICIAL column, the official project developer uploaded the image.<\/p>\n<h3>Retrieve a Docker Image<\/h3>\n<p>Choose the image you want, then use the pull option to download it. As for the syntax,<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker pull [image-name]<\/pre>\n<p>Run these commands to download the official Ubuntu image, for instance:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker pull ubuntu<\/pre>\n<p>Use the image to spin up a container once it has been downloaded. Instead, when attempting to create a container from an image that hasn&#8217;t been downloaded, Docker downloads the image first before proceeding to build the container.<\/p>\n<h3>Browse Downloaded Images<\/h3>\n<p>Run the command to see which images you have downloaded.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker images<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-237\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-docker-downloaded-images.png\" alt=\"check downloaded docker images\" width=\"800\" height=\"154\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-docker-downloaded-images.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-docker-downloaded-images-300x58.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-docker-downloaded-images-150x29.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-docker-downloaded-images-768x148.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-docker-downloaded-images-100x19.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-docker-downloaded-images-700x135.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>A list of all the downloaded images on your computer is produced by the command. It is an Ubuntu and MySQL Docker image in our situation.<\/p>\n<h3>Employing Docker Containers<\/h3>\n<p>An isolated virtual environment called a Docker container is produced from a Docker image. Use an image you&#8217;ve already downloaded or include its name in the docker run command to have the image downloaded and a container created automatically.<\/p>\n<p>Use the hello-world image, for instance, to start up a container and download a test picture. Run the command line:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker run hello-world<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-238\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/creating-container-docker.png\" alt=\"create downloaded image container\" width=\"800\" height=\"409\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/creating-container-docker.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/creating-container-docker-300x153.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/creating-container-docker-150x77.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/creating-container-docker-768x393.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/creating-container-docker-100x51.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/creating-container-docker-700x358.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>The command tells Docker to start a container and get the image from Docker Hub. After the container is created, a &#8220;Hello from Docker&#8221; greeting and an explanation of how it functions are displayed before Docker shuts it down.<\/p>\n<h3>Activate a Docker Container<\/h3>\n<p>Running a Docker container makes use of the run subcommand, much like in the test container produced in the preceding section. The following is the syntax for building a new Docker container:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker run [image-name]<\/pre>\n<p>Indicate the name of the picture to be used as the container&#8217;s foundation for [image-name]. Docker gives each new container it creates a distinct name. As an alternative, you can start a fresh container and give it a name by using the &#8211;name switch:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker run --name [container-name] [image-name]<\/pre>\n<p>Run the following command, for instance, to build a container using the Ubuntu image we previously downloaded:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker run ubuntu<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-239\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-non-interactive-container.png\" alt=\"running a docker container non ineractive mode\" width=\"800\" height=\"113\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-non-interactive-container.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-non-interactive-container-300x42.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-non-interactive-container-150x21.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-non-interactive-container-768x108.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-non-interactive-container-100x14.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/run-non-interactive-container-700x99.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Although it is in non-interactive mode, the command generates a container from the picture that is supplied. Use the -i and -t switches to get interactive shell access to the container. For instance:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker run -it ubuntu<\/pre>\n<p>The terminal updates itself to state that it is functioning inside the container and references the container ID to do so. To remove, start, or stop the container, use its ID.<\/p>\n<p>Pass any command to interact with the system after starting the container in interactive mode. Additionally, since root has access, sudo is not required. Any modifications made inside the container only affect that particular container. Run the exit command from the prompt to leave the container.<\/p>\n<h3>Check out Docker Containers<\/h3>\n<p>A Docker container that is currently running is said to be active. A container can be started, stopped, or removed using the unique ID and name that are output while listing containers.<\/p>\n<p>Run: to only see active Docker containers.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker ps<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-241\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checkout-docker-containers-ubuntu.png\" alt=\"list active docker containers on ubuntu\" width=\"800\" height=\"130\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checkout-docker-containers-ubuntu.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checkout-docker-containers-ubuntu-300x49.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checkout-docker-containers-ubuntu-150x24.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checkout-docker-containers-ubuntu-768x125.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checkout-docker-containers-ubuntu-100x16.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/checkout-docker-containers-ubuntu-700x114.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>An active container list is produced by the command. The containers have all been shut down, however, they are still present in the system if there are no containers on the list.<\/p>\n<p>Add the -a flag to list all containers, even dormant ones:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker ps -a<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-242\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-all-active-containers-in-ubuntu.png\" alt=\"view of active containers in ubuntu\" width=\"800\" height=\"252\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-all-active-containers-in-ubuntu.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-all-active-containers-in-ubuntu-300x95.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-all-active-containers-in-ubuntu-150x47.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-all-active-containers-in-ubuntu-768x242.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-all-active-containers-in-ubuntu-100x32.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/list-all-active-containers-in-ubuntu-700x221.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker ps -l<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-243\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/listing-latest-container-ubuntu.png\" alt=\"view latest containers in ubuntu\" width=\"800\" height=\"170\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/listing-latest-container-ubuntu.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/listing-latest-container-ubuntu-300x64.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/listing-latest-container-ubuntu-150x32.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/listing-latest-container-ubuntu-768x163.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/listing-latest-container-ubuntu-100x21.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/listing-latest-container-ubuntu-700x149.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<h4><strong>Open a New Docker Container<\/strong><\/h4>\n<p>Use the docker start command to restart a halted container. As for the syntax:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker start [container-ID | container-name]<\/pre>\n<p>Give the container name or the container ID. The name given to the container by Docker when it is created is distinctive. List all of the containers to obtain the ID and name. For instance, the Ubuntu container we previously established is started by the following command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker start 5f9478691970<\/pre>\n<h4><strong>Terminate a Docker Container<\/strong><\/h4>\n<p>Use the docker stop command to terminate a running Docker container. As for the syntax:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker stop [container-ID | container-name]<\/pre>\n<p>Run: for example, to terminate the active Ubuntu container.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker stop 5f9478691970<\/pre>\n<h4><strong>Uninstall a Docker Container<\/strong><\/h4>\n<p>Use the docker rm command to delete a needless Docker container. As for the syntax:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker rm [container-ID | container-name]<\/pre>\n<p>For instance, the container we previously built for the hello-world test is removed by the following command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo docker rm silly_hamilton<\/pre>\n<h4>Final Words on Installing Docker on Ubuntu Linux<\/h4>\n<p>Install the necessary dependencies before updating the system repositories. With the &#8220;$ sudo apt update&#8221; command to install Docker on Ubuntu 23.04. After that, import the Docker GPG key, and then add the repository to the system sources. To efficiently <a href=\"https:\/\/www.dedicatedcore.com\/blog\/remove-docker-images-containers-volumes\/\" target=\"_blank\" rel=\"noopener\">manage your Docker environment<\/a>, explore how to Remove\/Delete Docker Images, Containers, and Volumes to keep your system clean and optimized.<\/p>\n<p>The next step is to install Docker with the command &#8220;$ sudo apt install docker-ce&#8221;. This article covered how to set up Docker on Ubuntu 23.04. Hope you don\u2019t get confused about the install docker ubuntu or you can say Installation of Docker On Ubuntu 18.04 |20.04 | 22.04 | 23.04<\/p>\n<h3>Frequently Asked Questions (FAQ)<\/h3>\n<p><strong>1. What is Docker and why should I use it?<\/strong><\/p>\n<p>Docker is a platform for developing, shipping, and running applications in isolated containers. Docker is installed on each server and provides simple commands that you can use to build, start, or stop containers.<\/p>\n<p><strong>2. How can I Verify that Docker is installed correctly?<\/strong><\/p>\n<p>Running the following command you can check the docker&#8217;s status:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo systemctl status docker\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>On most other Linux distributions, including Ubuntu 23.04, Docker can be downloaded and installed. Similar to how you would use your distro&#8217;s package management to&#8230;<\/p>\n","protected":false},"author":1,"featured_media":419,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/222"}],"collection":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/comments?post=222"}],"version-history":[{"count":20,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/222\/revisions"}],"predecessor-version":[{"id":2563,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/222\/revisions\/2563"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/media\/419"}],"wp:attachment":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/media?parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/categories?post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/tags?post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}