You are on page 1of 2

Install Window-Docker.

Once installed successfully, you should see a icon like this below in your desktop
tray. When you mouse hover, it should say Docker Desktop is running

Go to the command prompt and type

docker version

It will display the docker version details.

Containers are completely isolated environment. They have their own Processors, Networks, and
Mounts, except that they share their own OS Kernels.

Try running the below commands.

docker run docker/whalesay cowsay Hello-World!

When you run the above command, it will first check whether you have any image in your local, if not, it
will try to download it and run it. This will display a diagram like whale and display the txt Hello World.

It is nothing but an already build Java Program, which someone has already uploaded to the docker
repository.

docker run nginx

Running the above command, will download and run the ngnix command.

To display all the running container.

docker ps

The above displays like below, it doesn’t show anything which run before.
Run now -> docker ps -a

This will display the screen like below, which shows all the images which you ran before.

The reason is:

The containers are not meant to run operating system, it is meant to do a specific task, process, web
server or application server. Once the task is completed, it is existed. The container lives as long as
the process is alive.

docker run -d nginx sleep 20

-d is to detach the command execution, so that you can use the same command prompt.

After executing the above command. Now run docker ps

You can see that nginx is now running, since you have provided the command sleep 20. After 20
seconds, if you run the ps command you will see no container running.

Browse for other docker commands in the net and practice, which is really needed for further work on
Kubernetes and Jenkins.

You might also like