Open In App

Docker Desktop Sample Image

Last Updated : 17 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Before talking about the docker desktop let’s understand what is docker. Docker is a service that allows you to containerize your application into a single unit, which allows you to run your application from one computer environment to another. This makes application portable between systems and solves the “it works on my computer” problem.

What is Docker Desktop?

Docker Engine is just a Command line interface (CLI) based software for managing your docker files. If you are a programmer and use git, then just think of docker cli as git. But sometimes it makes the task very overwhelming. Then the Docker Desktop comes into the picture, it is a Graphical user interface (GUI) based application. It contains Docker Engine, Docker CLI client, Docker Compose, Docker Content Trust, Kubernetes, and Credential Helper. Docker Desktop still uses Docker Engine underneath.

Features Of Docker Desktop

  • Simple and user-friendly interface
  • Easy way to create and manage volumes
  • One-click Kubernetes setup for your local computer
  • A dashboard for a quick overview of running containers, images, and volumes

How to install Docker Desktop?

1. Go to https://hub.docker.com/ to download the docker to know more about how to install docker on Windows refer to How to Install Docker on Windows.

Docker desktop

2.Create your account with your desired password and use

3. After creating your account, you will see the Download button on the landing page, you can even switch your architecture depending on machine, docker desktop is available in Windows, Mac and Linux.

4. After downloading the docker, Let’s start with the installation process, double click on the .exe file that you have downloaded and you will see a window like this click on “OK” button

Download docker

5. Then it will start the installation process by unpacking some files. It might take sometime depends upon your machine.

Unpacking files

6. After that it will start the installation on it own and you will see message like this of successful installation and saying it to restart your computer. For everything work seamlessly in the system, restart your machine.

7. After restarting your machine open the installed application and accept the term and condition license.

Accept terms and conditions

8. After that, signing with you docker account that you created in Step 2

How to Use Docker Desktop?

With the docker desktop you have the access of all images that are available on the docker hub site in this example, I am running the ubuntu’s official image.

Pull Ubuntu Image

You can simply download and any official image file that are available on the dockerhub’s official site. Image are nothing but a package file where officials from ubuntu they combined all the packages, dependencies etc that are required to run ubuntu

1. Go to image section and the search for ubuntu

Ubuntu Image

2. Click on pull button with latest version tag, by doing this it will download the ubuntu from docker hub

Images

3. Then Click on run button run the ubuntu, after doing this it show the status “In use” instead of unused

local images

We can do all this thing using docker cli as well, here is the demo where I ran the ubuntu bash using docker cli and printed “hello nitin” on the powershell

run the image

docker ps

Nginx-Dockerfile-Example

So now it’s time see the live demonstration of, how we can create custom docker image using nginx

1. Firstly install the “nginx:latest” image from the docker desktop or from cli like we installed the ubuntu above and after that let’s test it weather if it working or not, run it by the following command:

docker container run --name nginx -p 8080:80 nginx:latest





2. Run this command in you CMD / Powershell and after that open any web browser type “localhost:8080” , we are running nginx on our localhost on the port 8080 , yay!!

running nginx on port 8080

3. After that make a folder “nginx” and open it in any code editor, I am using VS Code and then make a “dockerfile” , do not use any kind of extension. and type these configuration

Dockerfile

4. use any html template, I am using some random free template downloaded from the internet and paste it in the folder, your directory will look something like this:

the directory

5. Now open vs code’s terminal and make the docker image using the following command, you can use any name instead of using “my_site” and test if it is build successfully or not

docker build -t my_site .
docker images






You can see the practical implementation here:
Dockerbuild

6. After that let’s containerized this and run it, “choose desired name of your container“ and expose any port of your choice I am using “2212:80” and then enter your name site that you have created above

docker run --name my_container -p 2212:80 my_site






Docker run container

Result:

Troubleshooting Docker Desktop

While using the docker desktop you might face the problem with WSL like that

kernal version

To fix this you simply you have to open the cmd as administrator and type this command

    wsl --update






version updatedConclusion

You can even create and deploy your own image file and with docker desktop can you save yourself from the hectic of using cli. Docker free for small businesses less than 250 employees and less $10 annual revenue, and it free for education as well as for personal use.

FAQs On Docker

1. Why We Need Docker?

With the help for docker we can avoid the hectic on installing the libraries and dependencies that used in a particular software.

2. Are Docker Images Operating System Dependent?

NO, a Docker image can run on a different OS as long as the host system has Docker installed.

3. Where Docker Logs Are Stored?

Docker logs are stored as JSON files on the host machine’s file system in /var/lib/docker/containers by default



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads