Monday, August 20, 2018

Docker Installation And Some Commands

Everyday technology is evolving and we are implementing or better to say find out the way more stable, easy and hardware to the software-centric solution.

So Docker is one of the most popular solutions for that. Previously we are habituated to use virtual machines but nowadays we are more focused on Dockerization. In Docker we get some extra facility over VM, key-points are discussed below :


As per the diagrammatic difference, we say that in every VM's have an own OS or we can say need a guest OS but in Docker, we don't need any guest OS Docker to use the host OS kernel in read-only mode so it's lighter. Docker Demon service plays the role in the background to communicate with the kernel, resource sharing and many more things in the background. Here one thing we need to know Docker CE for Windows provides development environments for both Linux and Windows Containers. The Linux Docker host on Windows is based on a Hyper-V VM

So let's start to install and configure the Docker in Windows 10 machine.

Step 1 : 
 We can find two types of Docker installer.
  • Docker Community Edition (CE)
  • Docker Enterprise Edition (EE)


Here we will use CE for Windows. So we need to download the Docker agent for Windows, in this discussion we are using Windows 10.


Here we need to keep in mind
  • Need Hyper-V enabled.
  • Virtualization must be enabled from BIOS.
  • Windows 10 version should be 64bit Windows 10 Pro, Enterprise and Education (1607 Anniversary Update, Build 14393 or later)
Step 2 :
Click on Download From Docker Store Button.and then click on Please Login To download button from next page.

 For downloading the Windows Docker agent need to have docker account after providing the login details we need to click the Get Docker button from the next page,

If we don't have the docker account we need to create that one from Create Account link from the login page.




Step 3: 
 Just install the Docker agent with default settings. After installation successfully completed and restarted the machine we can find a white color whale(the whale’s name is “Moby Dock) bearing a pile of shipping containers in the system tray.

If Docker is not able to start successfully it will available as a red color whale in the system tray.


 Step 4 : 
 Now we are in shape to discuss some mostly used docker commands.

  • docker info  
           This command gives us the docker info like running paused or stopped containers, images etc.


  • docker version
            This command gives us the docker version details

  • docker images
            This command gives us the downloaded image details

  • docker pull <image name> 
            This command used to download the images

We can also pass the tag name when we pull any particular version of image else it will download the latest one.
The command looks like docker pull <image name>: tag-name
  • docker run <image name>
            This command used to run the container
 We can also pass the tag name when we run any particular version of image else it will run the latest one.
The command looks like docker run<image name>: tag-name
  • docker run --name <custom name> <image name>
             This command helps us to run a container with a meaningful name.
  • docker run -t -i <image name>
             This command is used to run the container in interactive mode. Here -t parameter represents terminal and -i parameter represents interactive mode.

  • docker run -d <image name> 
                 This command is used to run a image in demon or detached mode.
     
  • docker run -P <image name> 
             This command is used to publish a port to communicate with container and it will assign a dynamic port.
  • docker run -p mappingport:port <image name> 
             This command is used to publish a specific port to communicate with container.
  • docker run --link <linking container name> :<alias>  <container imagename>
                  This command is required to communicate with different containers.

  • docker container ls -a
            This command gives us the containers details


  • docker ps -a
            This command gives us the containers details



  • docker stop <container name or container id>
             This command used to stop the container

  • docker container stop <container name or container id
            This command used to stop the container

  • docker rm <container name or container id
            This command used to remove the container

  • docker container rm <container name or container id
            This command used to remove the container

  • docker rmi <imagename>  
             This command used to delete the image

  • docker rmi  -f <imagename>  
             This command used to delete image forcefully

  • docker logs <container name or container id>
             This command used to show the logs for a particular container.

  • docker search <image name>
               This command is useful to find out any perticular image from Docker hub repository.


  •  docker inspect <container name or container id>
              This command is useful to get all the container configuration details.
  

5 comments:

  1. Very informative and the way of explaining things is really nice! :)
    Kudos to the author!

    ReplyDelete