12/28/2021

Update Docker On Ubuntu

35

Install Latest Docker and Docker-compose on Ubuntu. # Ask for the user password. # Script only works if sudo caches the password for a few minutes. # Install kernel extra's to enable docker aufs support. # sudo apt-get -y install linux-image-extra-$ (uname -r). How to update packages inside a Docker container on Ubuntu If you want the package present in the current Docker container, then execute the “ apt update ” command in the following way: email protected:/# apt update. Dec 24, 2019 Install Docker on Ubuntu. For this article, we will use Ubuntu 18.04. Ubuntu 18.04; sudo user; Step 1: Update the local database. Before installation, start by updating the existing list for packages. Sudo apt update Step 2: Install dependencies that support https. Install packages that will allow apt to transfer files over https.

  1. Update Docker On Ubuntu 20.04
  2. Upgrade Docker Version On Ubuntu
  3. Upgrade Docker On Ubuntu 18.04

Build and run container images with Docker.

Usage

  • This build can only access files in the home directory. So Dockerfiles and all other files used in commands like docker build, docker save and docker load need to be in $HOME.
  • You can change the configuration of this build by modifying the files in /var/snap/docker/current/.
  • Additional certificates used by the Docker daemon to authenticate with registries need to be added in /var/snap/docker/current/etc/docker/certs.d (instead of /etc/docker/certs.d).

Running Docker as normal user

By default, Docker is only accessible with root privileges (sudo). If you want to use docker as a regular user, you need to add your user to the docker group.

Warning: if you add your user to the docker group, it will have similar power as the root user. For details on how this impacts security in your system, see https://docs.docker.com/engine/security/#docker-daemon-attack-surface

Authors

Docker

This snap is built by Canonical based on source code published by Docker, Inc. It is not endorsed or published by Docker, Inc.

Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries. Docker, Inc. and other parties may also have trademark rights in other terms used herein.

Docker is a free, open-source and cross-platform containerization tool that helps you to deploy and run the application in an isolated environment. Docker has become one of the most important parts of modern software development and DevOps pipelines.

In this tutorial, you will learn –

Prerequisites

  • A server running Ubuntu 20.04.
  • A root password is configured on your server.

Install Docker on Ubuntu

There are two ways to install Docker on Ubuntu 20.04. You can install Docker from the Ubuntu default repository or from the Docker’s official repository. The latest version of Docker is not included in the Ubuntu default repository. So it is always recommended to install Docker from Docker’s official repository.

In this section, we will show you how to install Docker on Ubuntu from Docker official repository.

Step 1 – Install Required Dependencies

Docker

First, you will need to install some prerequisite packages in your system. You can install them by running the following command:

Step 2 – Add Docker Official Repository

Next, you will need to import the GPG key and add the Docker repository to your system.

First, import the GPG key with the following command:

Next, add the Docker official repository using the following command:

Once the repository is added, update the repository cache with the following command:

Step 3 – Install Docker Ubuntu

Once the repository is updated, you can install the Docker on Ubuntu by running the following command:

This command will install the latest version of Docker from the Docker official repository.

20.04

Step 4 – Verify Docker Version

Once the Docker has been installed, you can verify the installed version of Docker with the following command:

You should get the following output:

Step 5 – Install a Specific Docker Version

If you want to install a specific Docker version, first list all available Docker versions using the following command:

You should see all the Docker version in the following output:

Now, install the specific version of Docker by adding =version after package name as shown below:

Step 6 – Manage Docker Services

To start the Docker service, run the following command:

To enable the Docker service at system reboot, run the following command:

To check the status of Docker service, run the following command:

Run Docker Commands Without Sudo

By default, Docker can be run as a root user or with Sudo privileges. If you want to run Docker commands as a non-root user then you will need to add your user to the docker group.

You can add your user to the docker group using the following command:

Now, your user can run Docker commands without specifying sudo.

Update Docker On Ubuntu

Docker Basic Commands

You can list all commands available in Docker with the following command:

You should get a list of all commands in the following output:

To see system-wide information about Docker, run the following command:

Output:

How to Use Docker

At this point, Docker is installed and running in your system. Next, you will need to check whether you can access and download the image from DockerHub.

Let’s download the hello-world image from the DockerHub using the docker pull command:

This will download or pull the hello-world image from the DockerHub repository as shown below:

Next, verify the downloaded image with the following command :

Update Docker On Ubuntu 20.04

You should see your downloaded image in the following output:

Upgrade Docker Version On Ubuntu

Next, run a container from the hello-world image with the following command:

You should see the following output:

How to Uninstall Docker

If you want to uninstallDocker from your system. It is recommended to remove all Docker containers, images and volumes from your system.

First, stop all running containers with the following command:

Upgrade Docker On Ubuntu 18.04

Once all containers are stopped, remove them with the following command:

Next, remove all Docker images with the following command:

Next, remove all docker objects with the following command:

Finally, remove the Docker package with all dependencies by running the following command:

Conclusion

In the above post, you learned how to install and use Docker on Ubuntu 20.04. To learn more about Docker, check out my all Docker tutorial.

  • Most Viewed News