How To Install Docker on Ubuntu 18.04 & 16.04 LTS
Docker is a container-based application framework, which wraps a specific application with all its dependencies in a container. Docker containers can easily ship to the remote location on start there without making the entire application setup. This tutorial will help you to install Docker on Ubuntu 19.10, 18.04 LTS, and 16.04 LTS systems.
1. Prerequisite
The very first step is to remove any default Docker packages from the system before installing Docker on a Linux VPS. Execute commands to remove unnecessary Docker versions.
Now install some required packages on your system for installing Docker on the Ubuntu system. Run the below commands to do this:
2. Setup Docker Repository
Now import dockers official GPG key to verify packages signature before installing them with apt-get. Run the below command on the terminal.
After that add the Docker repository on your Ubuntu system which contains Docker packages including its dependencies. You must have to enable this repository to install Docker on Ubuntu.
3. Install Docker on Ubuntu
Your system is now ready for Docker installation. Run the following commands to upgrade apt index and then install Docker community edition on Ubuntu.
After successful installation of the Docker community edition, the service will start automatically, Use below command to verify service status.
Your system is now ready for running Docker containers. Use our Docker Tutorial for Beginners to work with Docker.
4. How to Use Docker
After installation of Docker on Linux. Here are some basic details for searching and downloading Docker images, launching containers, and managing them.
Search Docker Images
First of all search Docker container images from the Docker hub. For example, the below command will search all images with Ubuntu and list as output.
Download Docker Images
Now download the Docker container with the name Ubuntu on your local system using following commands.
Now make sure that the above images have been downloaded successfully on your system. Below command list all images.
Launch New Container with Image
Finally, launch a Docker container using an above-downloaded image on your system. The below command will start a new container and provide you access to that container with /bin/bash shell.
To exit from docker container type
After exiting from the Docker container, execute the below command to list all running containers.
By default Above command will list only running containers. To list all containers (including stopped container) use following command.
Start/Stop/Attach Container
You can start, stop or attach to any containers with the following commands. To start container use following command.
To stop container use following command.
To attach to currently running container use following command.
0 Comments
CAN FEEDBACK
Emoji