To uninstall Docker, execute the following command. sudo docker ps -a Uninstallaing Docker from Ubuntu You can view all the stopped and running containers using the following command. If it doesn’t find any, docker will automatically pull down the image from the docker hub. When you execute the “docker run” command, docker will look for the base image in the local system respository. Note: You can also create a container without having an image in the local repository. You can try installing some packages in that container. The above command will create an interactive container with a bash shell. sudo docker run -i -t -name test ubuntu:latest Let’s create an interactive container named “test” from the ubuntu image using the following command. Now we have the latest ubuntu docker image in our host. sudo systemctl list-unit-files -type=service | grep rvice Run a Docker Container To check if Docker is enabled on boot, execute the following command. It will list all the downloaded and created images in the local repository. Verify the downloaded image using the following docker command. Let’s try to pull the latest ubuntu base image from the docker hub using the following docker command. Now we have docker installed on the host.
To test the docker installation on Ubuntu, let’s go through some of the basic docker operations. sudo usermod -aG docker $USERĮxit the current terminal and log in again to use the docker commands without sudo. Here is the command to add the current user to the docker group. To docker commands without using sudo, you need to add the system user to the Docker group.
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: If you try to run Docker without sudo as a normal user, you will get the following error. curl -sSL | sudo sh Run Docker Commands Without Sudo
Sudo service docker start install#
To install the latest docker release just execute the following curl command. If you are trying out Docker or using it for test purposes, you can use a one-liner command to install Docker. Step 6: Verify the Docker installation sudo docker version Method 2: Installing the latest Docker release sudo apt-get install docker-ce docker-ce-cli containerd.io -y If you want to install the latest release of Docker, you need to install it from the source.įollow the instructions given below to install docker from the apt repository. The installation package available in the repository will not be the latest version. Method 1: Install Docker From apt Repositoryĭocker package is available in the native apt repository. We will look at two methods to install Docker.