Full Course on Docker
A container management service is Docker. Develop, ship, and operate anywhere are the operative terms for Docker. The whole point of Docker is to make it simple for developers to create programmes, package them into containers, and then deploy those containers wherever.
1.Docker containers can be set up anywhere, on any real or virtual system, even in the cloud.
2.Teams from various departments, including development, QA, and operations, can more easily collaborate across apps with the use of containers.
3.Docker can offer an operating system with a smaller footprint, hence reducing the amount of development.
Linux Docker installation
Step by Step :How to Install Docker on Linux
1.Make sure you are running the correct Linux kernel version before installing Docker.
uname returns the system information
a- the system’s data is guaranteed to be returned.
2.The following command can be used to update the OS with the newest packages as needed.Using this technique, packages are downloaded and installed on a Linux system.
sudo apt-get update
where sudo is used to make sure the command is executed with root access , and the update option is used to make sure that every package on the Linux system is updated.
3.Installing the requisite certificates is the next step, which is needed to later connect to the Docker website and download the relevant Docker packages.
sudo apt-get install apt-transport-https ca-certificates
4.The new GPG key needs to be added next. When downloading the appropriate Docker packages, this key is necessary to guarantee that all data is encrypted.
5.The Ubuntu system’s packages are then updated using the apt-get update command.
6.The apt-cache tool can be used to check if the package management is referring to the correct repository.
apt-cache policy docker-engine
7.To make sure all the packages on the local system are up to date, use the apt-get update command.
8.Installing the linux-image-extra-* kernel packages is required for Ubuntu Trusty, Wily, and Xenial in order to use the aufs storage driver.
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
9.Installing Docker is the last step,
sudo apt-get install –y docker-engine
Check Docker Version in your System
sudo docker version
Installation on Windows
1. Download the installer, double-click it to launch it.
2.To finish the installation, click the Finish button.
After downloading the installer, double-click it to launch it, then adhere to the instructions below.
1.On the start screen, click the Next button.
2.On the following screen, leave the default location alone and press the Next button.
3.Click the Next button to continue and keep the default components.
4.Click the Next button after leaving the Additional Tasks alone.
5.Click the Install button on the last screen.
Docker – Containers
The Docker run command is used to control the running of containers. Launch the Docker container first if you want to execute a container interactively.
sudo docker run –it centos /bin/bash
A list of the containers
1.The currently running containers are returned by this command.
sudo docker ps
2.docker ps -a
To view a list of every container on the system, use this command.
sudo docker ps –a
You want to view all the commands that were executed against the specified Image ID.
sudo docker history centos
This command allows you to view a container’s top processes.
sudo docker top djbjdshjs2617 5.docker stop
A running container can be stopped using this command.
sudo docker stop djbjdshjs2617
You can use Docker to generate your own Docker images, and Docker Files can be used to accomplish this.
Step 1.Make a Docker File file and edit it with vim.
$ sudo vim Dockerfile
Step 2.Make your Docker file by following the steps below.
$ sudo apt-get update
$ sudo apt-get install –y nginx
Step 3.Save the file
docker build -t ImageName:TagName dir
To mention a tag for the image, use -t.
The name you want to give your image is ImageName.
TagName is the tag you should use to identify your image.
dir — The location of the Docker file in the system.
Public Repositories for Docker
Docker images can be stored in public repositories for usage by other users.
Step 1.Create your repository after logging into Docker Hub.
Step 2.Create a repository .Make a note of the pull command that is associated with the repository once it has been created.
docker pull demousr/demorep
Step 3.Return to the Docker Host now. Here, we must tag our myimage with the newly formed Docker Hub repository.
Step 4.To log into the Docker Hub repository from the command prompt, use the Docker login command. Your username and password for the Docker Hub repository will be requested by the Docker login command.
Step 5.It’s time to push the image to the Docker Hub repository after it has been tagged. The Docker push command can be used to accomplish this.
Know More about Docker:Docker Course
Using Docker to Manage Ports
Docker allows for the operation of apps on ports within the containers themselves. You must map the port number of the container to the port number of the Docker host when running a container if you wish to contact the application within the container through a port number.
Step 1.You must first complete a quick sign-up on Docker Hub.
Step 2.You will be logged into Docker Hub after registering.
Step 3.Let’s search for the Jenkins image next.
Step 4.The Docker pull command can be seen if you scroll down on the same page. On the nearby Ubuntu server, the Jenkins Image will be downloaded using this method.
Step 5.Go to the Ubuntu server now, then issue the command
sudo docker pull jenkins
Step 6.Use the Docker inspect command to inspect the image to learn which ports the container exposes.
The container or image’s basic information can be returned using this function.
sudo docker inspect jenkins
The inspect command produces a JSON output as its result.
Read More About:Crash Course of SQL