11 Docker Commands: A Guide of Docker Commands with Examples [2023]

Docker – ‘A better way to build apps’, as stated on its website, is an open-source platform for building apps and microservices. The catch here is the automated deployment of your app in a container, by OS level virtualization provided by Dockers. Dockers are better than VMs as you can do away with the additional costs for maintaining and starting the latter. By deploying your app and its dependencies (i.e. the pre-requisite apps for its proper functioning) in a container, your app becomes portable during all the phases of development and testing. Moreover, the isolated apps eliminate conflicts, enable team collaboration, and reduce the time-to-market.


When Do You Need to Use a Docker?

  • For replicating the environment on your server, while running your code locally on your laptop
  • For Docker CI/CD during numerous development phases (dev/test/QA)
  • For distributing your app’s OS with a team, and as a version control system.

How Do You Setup a Docker Locally

  • Download a Docker edition and the Docker Toolbox
  • Make sure your BIOS has Virtualization Technologies, AMD-V, or KVM enabled
  • Install the Extension Pack in the Oracle VirtualBox.
  • Run the Setup

How Do You Use a Docker?

The biggest advantage of VMs is that they create snapshots which can be revisited instantly later. Docker containers further enhance the lightweight process virtualization by being OS-independent and using the Linux Kernel’s functionality. They are created from Docker images – like snapshots. Docker images are created using a Docker file which can be customized or used as is. The default execution driver for creating a docker container is ‘libcontainer’.  Docker Hub can be used for searching docker images and seeing the way they have been built.

  • To create a Docker container, download the ‘hello world’ image, by typing the following command in the terminal –

$ docker run the hello world

  • For checking the number of images on your system, use the following command –

$ docker images

  • For searching an image in the Docker Hub –

$ docker search <image>

Here’s a List of Docker Commands

  • docker run – Runs a command in a new container.
  • docker start – Starts one or more stopped containers
  • docker stop – Stops one or more running containers
  • docker build – Builds an image from a Docker file
  • docker pull – Pulls an image or a repository from a registry
  • docker push – Pushes an image or a repository to a registry
  • docker export – Exports a container’s filesystem as a tar archive
  • docker exec – Runs a command in a run-time container
  • docker search – Searches the Docker Hub for images
  • docker attach – Attaches to a running container
  • docker commit – Creates a new image from a container’s changes

Check out the complete list of Docker commands in the Docker documentation


Examples of Using a Docker

  • You can run WordPress locally on your laptop by downloading Docker, without having to install Apache, PHP, MySQL etc. The Docker Toolbox creates a containerized version of Linux to run the Docker in a VM.
    • Download Docker Tool Box which will install the Oracle VirtualBox.
    • Install the Extension Pack in the VirtualBox.
    • Type $ docker run hello-world in the terminal to check if your installation has finished properly.
    • Search for a WordPress image on the Docker Hub to install WordPress locally.
  • Similarly, you can install DokuWiki using dockers.
  • Dockers can be used for testing SDN components

Here are a few samples to get your docker engine up and running.

*All the examples in this article are for installing Docker commands on Windows. You can always run it on a Linux VM.


  • Sreeja

    my containers are not listed…. i use linux…………..what should i do??

  • I have Joomla and a Joomla template(rt_refraction_j15) installed on my website. But i want the same template and css styling, as a basic HTML template, so i don’t have to use Joomla for editing. Is there an easy way to convert the template to basic HTML/CSS template?.

  • Shubham Kumar

    What command should you run to see all running container in docker?

  • Shiwanand

    NICE articulated in simple words

  • Jacqulyn Olberding

    Do you mind if I quote a few of your articles as long as I provide credit and sources back to your website? My blog is in the exact same area of interest as yours and my users would definitely benefit from some of the information you provide here. Please let me know if this okay with you. Cheers!

  • Giovanna Cartmell

    Bravo what a great message

  • January Kadner

    I really like your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for you? Plz answer back as I’m looking to construct my own blog and would like to find out where u got this from. kudos

  • Marisela Mathies

    Greetings from California! I’m bored to tears at work so I decided to check out your site on my iphone during lunch break. I love the knowledge you provide here and can’t wait to take a look when I get home. I’m amazed at how quick your blog loaded on my phone .. I’m not even using WIFI, just 3G .. Anyhow, excellent blog!

  • Nigel Hiefnar

    I love your wordpress design, exactly where would you download it from?

  • Carol Suarez

    A person never realizes all his capabilities while he is chained to the ground. We must take off and conquer the skies.

  • Anas K

    What command should you run to see all running container in docker?

    Docker ps -here will list all running containers
    docker ps -a here will list all running and stoped containers

  • Marlin Leviner

    Your style is very unique compared to other folks I have read stuff from. Many thanks for posting when you’ve got the opportunity, Guess I’ll just bookmark this blog.

  • May Bethurem

    Having read this I believed it was rather informative. I appreciate you spending some time and energy to put this article together. I once again find myself spending a significant amount of time both reading and posting comments. But so what, it was still worth it!

  • Amina Gomzales

    After checking out a few of the articles on your web site, I truly appreciate your technique of blogging. I book marked it to my bookmark site list and will be checking back soon. Please visit my web site too and tell me what you think.

  • Ammie Sloss

    Hey there! I just would like to offer you a big thumbs up for your great information you have got right here on this post. I am returning to your web site for more soon.

  • Shonda Organ

    This page certainly has all the info I wanted concerning this subject and didn’t know who to ask.

  • Buy Elite Proxies

    An impressive share, I just given this onto a colleague who was doing just a little evaluation on this. And he in actual fact purchased me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the treat! However yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading more on this topic. If attainable, as you develop into experience, would you mind updating your weblog with more details? It’s extremely useful for me. Massive thumb up for this blog put up!

  • Cyril Rodriuez

    You’ve made some decent points there. I checked on the net to find out more about the issue and found most people will go along with your views on this website.

  • docker ps -a

    it shows all the running dockers

  • Margarett Bindrup

    I agree with your points, superb post.

  • Hey there, You have done a fantastic job. I’ll definitely digg it
    and personally recommend to my friends. I’m confident
    they will be benefited from this website.

Leave a Reply