How to install and configure Docker on Ubuntu 18.04

Docker is an open source technology used to deploy applications through the . It is a relatively new platform, but it is constantly updated and has a large community of users. In this tutorial, we will show you how to install Docker on Ubuntu 18.04.

is an amazing tool that solves the age old problem between developers and system administrators: developers determine if an application works on their machine, while system administrators worry about changing libraries and requirements. With Docker, this is no longer an issue as it provides a more transparent method of communication.

Docker is essentially a virtual machine, which allows you to run images. With Docker, you don’t need to worry about requirements and it’s the perfect tool for many .

Docker is very popular with developers and seamlessly your favorite.

With this in mind, let’s learn how to install Docker on Ubuntu 18.04.

Why do users install Docker on Ubuntu?

Let’s do a quick rundown of the main benefits users get from using Docker Compose.

Docker is adaptable, allowing users to continuously test, deploy, and verify the results as many times as they want, with all the associated implications. This makes it a lab in itself, where a user can experiment with new commands to populate the container and make it functional for various tasks.

This tool is also compatible with multi-cloud computing, which means that it is adaptable to applications that use cloud computing to store data on servers. Think of services like Microsoft Azure, Puppet, Ansible, OpenStack and others.

Segregation in an isolated environment is another main aspect of Docker Compose that attracts developers. Additionally, Docker works with sensitive OS mountpoints like /sys Y /procwhich are read-only mounts.

How to install Docker on Ubuntu 18.04

Docker is not part of the official Ubuntu 18.04 repositories. However, the installation process is not affected by this. Let us begin.

1. Access your VPS

First, you have to connect to the server using SSH. If you have questions or problems with this, consult our

2. Update your system

The system should then be updated to make it more secure and reliable for the Docker installation. Run the following two commands:

sudo apt update sudo apt upgrade

3. Install the prerequisite package

Once you’ve upgraded your system, you’ll need to install some necessary packages before installing Docker. You can do it with the help of a single command:

sudo apt-get install curl apt-transport-https ca-certificates software-properties-common

To better understand the above command, here is a brief description of what it means:

  • apt-transport-https: allows the package manager to transfer data over https
  • ca-certificates: allows the web browser and the system to verify security certificates
  • curl: transfer data
  • software-properties-common: add scripts to manage the software
See also  .mx domain | Get to Mexico Using This Domain Today!

4. Add the Docker repositories

Now you have to add the Docker repositories. This will make the installation process much easier and at the same time you will be able to use the officially supported installation method.

First, add the GPG key, by entering the following command at the command line:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

Next, add the repository:

sudo add-apt-repository “deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”

After that, update the repository information:

sudo apt update

You can make sure you are installing from the Docker repository instead of the default Ubuntu repository with this command:

apt-cache policy docker-ce

Correct output will look like the following with different version numbers:

docker-ce: Installed: (none) Candidate: 16.04.1~ce~4-0~ubuntu Version table: 16.04.1~ce~4-0~ubuntu 500 500 https://download.docker.com/linux/ ubuntubionic/stableamd64packages

As you can see, docker-ce is not installed, so we can move on to the next step.

5. Install Docker on Ubuntu 18.04

You’re almost done. Use the apt command to install Docker:

sudo apt install docker-ce

6. Check Docker status

Once the installation is complete, it’s a good idea to check the status of the service:

sudo systemctl status docker

That’s it, now you know how to install Docker on Ubuntu 18.04. Easy, right? Now let’s fire up some Docker basics!

How to get started with Docker on Ubuntu 18.04

Once Docker is installed, all you have to do is use the test image to verify that everything works as it should. You can do this with the following command:

sudo docker run hello-world

Now, if you want to search for available images, you just have to use the following command:

sudo docker search

It simply replaces your query with the text in the brackets.

For example, if you want to search for a Debian-related image, the command and output will look like this:

sudo docker search debian

Then, to download the image to your computer, use the image name along with the following command:

sudo docker pull

In practice, the command would look like this:

sudo docker pull debian

Typically, users have multiple images on their system. You can list them with the command:

sudo docker images

The list will look a lot like the one displayed when you enter a search query.

After that, you can run an image using the pull command and the image ID.

sudo docker run -i -t

See also  Cloudprober explained: how we use it at

There are options that extend the functionality of the command itself. For example, the option -Yo makes the execution of the image interactive. or the option –dwhich runs Docker in the background.

Once you run an image, you can end the run using the key combination CTRL+D.

Finally, if you want to use Docker without root privileges, you need to run the following command:

sudo usermod -aG docker $(whoami)

After this, reboot the system and the changes will be applied.

Using the Docker command

The Docker command consists of passing options, commands, and arguments. The syntax will follow the following form:

docker

To see all available subcommands, use the following command:

docker

To see the options available with a command:

docker docker-subcommand –help

Here are the available Docker 18′ subcommands:

docker attach – Attach local standard input, output, and error streams to a running container docker build – Create an image from a Dockerfile docker builder – Manage builds docker checkpoint – Manage checkpoints docker commit – Create a new image from of changes to a container docker config – Manage Docker configurations docker container – Manage containers docker context – Manage contexts docker cp – Copy files/folders between a container and the local file system docker create – Create a new container docker diff – Inspect changes to files or directories in a container’s file system docker events – Get real-time events from the server docker exec – Execute a command on a running container docker export – Export a container’s file system as a docker tar file history – Display the history of an image docker image – Manage images docker imag en – List images docker import – Import the contents of a tarball to create a file system image docker info – Show system-wide information docker inspect – Return low-level information about Docker objects docker kill – Remove one or more containers in run docker load – Load an image from a tar or STDIN file docker login – Log in to a Docker log docker logout – Log out of a Docker log docker logs – Retrieve logs from a container. docker manifest – Manage Docker image manifests and manifest lists docker network – Manage networks docker node – Manage Swarm nodes docker pause – Pause all processes within one or more containers docker plugin – Manage plugins docker port – List port mappings or a specific mapping for the docker container ps – List containers docker pull – Pull an image or repository from a registry docker push – Push an image or repository to a registry docker rename – Rename a container docker restart – Restart one or more docker containers rm – Remove one or more docker containers rmi – Remove one or more images docker run – Execute a command in a new container docker save – Save one or more images to a tar file (streamed to STDOUT by default) docker search – Search images in Docker Hub docker secret – Manage Docker secrets docker service – Manage service s docker stack – Manage stacks docker start – Start one or more stopped containers docker stats – Show a live stream of resource usage statistics for containers docker stop – Stop one or more running containers docker swarm – Manage swarm docker system – Manage Docker docker tag – Create a TARGET_IMAGE tag that references SOURCE_IMAGE docker top – List running processes in a container docker trust – Manage trust in Docker images docker unpause – Resume all processes within one or more containers docker update – Update the configuration of one or more containers docker version – Show Docker version information docker volume – Manage volumes docker wait – Block until one or more containers are stopped, then print their exit codes

See also  What is the difference between hosting and domain?

Understanding Docker

The main novelty of Docker is that it allows you to “package” an application or a set of services in containers. A Docker container is an application instance that contains all the necessary libraries and components for an application to work. From a practical point of view, a container is a type of reduced virtual machine that works independently of the operating system where a specific application or service is running.

A Docker container is built from an image that is the result of the packaged application or service. It may contain a complete operating system or pre-installed applications. That is, from an image the container starts to work.

There are many Docker images that we can use in our daily work cycle. We can also create our own images and further expand the possibilities of this great application.

conclusion

The benefits of Docker make software deployment much more efficient than ever before. Thanks to this, developers will have no problem knowing how their application will run outside of the test environment. On the other hand, the system administrator does not…

Loading Facebook Comments ...
Loading Disqus Comments ...