OneBite.Dev - Coding blog in a bite size

use docker on windows

Simple docker step by step how to use docker on windows with explanation

Using Docker on Windows is an efficient way to manage application development workflows. Here’s a simple guide to help you understand and carry out the process.

Installing Docker on Windows

Before you start, make sure your Windows version supports Docker Desktop. You require Windows 10 64-bit: Pro, Enterprise, or Education (Build 15063 or later). Also, you need Hyper-V and Containers Windows features enabled. Now, let’s proceed with the installation.

  1. Visit the Docker Desktop for Windows download page (https://www.docker.com/products/docker-desktop) and click on “Get Docker”.
  2. Once the installer is downloaded, execute the installer like you would any other .exe file.
  3. Follow the prompts in the installer, accept licence terms and authorization, and proceed accordingly.
  4. After the installation is complete, Docker will start automatically.

You can confirm Docker is installed correctly by opening the command prompt and typing ‘docker -v’. If Docker is properly installed, you should see Docker’s version number in response.

Running Docker on Windows

  1. Run Docker by clicking on Docker Desktop shortcut or search it through the start menu. Docker will start, and an icon will appear in the taskbar indicating it’s running.
  2. To run Docker containers, it’s necessary to open a command prompt or powershell and type the command as per your requirements. For example, to run an instance of a hello-world container, you can type ‘docker run hello-world’ and hit enter. After a few moments, Docker will download the hello-world image and run a container of it. You’ll see an informational message confirming that your installation appears to be working correctly.

Downloading Images with Docker

Docker images are templates you can use to create containers. There’s a wide variety of pre-made images available on Docker Hub.

Here is how to download images using Docker:

  1. Let’s use Ubuntu as an example. To download the latest Ubuntu image, open the command prompt and type ‘docker pull ubuntu’.
  2. Docker will begin to download the Ubuntu image. Once done, it will be available for you to create Ubuntu Docker containers.

Creating Docker container

Now that you’ve downloaded an image, you can create a new container from that image.

  1. Run the command ‘docker run -it ubuntu bash’. Here ‘it’ enables interactive mode and ‘bash’ is the command to open Ubuntu terminal.
  2. After running the command, you should find yourself in the command line of a running Ubuntu container.
  3. To exit the container, press Ctrl+D.

You’ve now learned how to install Docker on Windows, run Docker containers, download images and create new Docker containers from those images. Practice these processes for a seamless Docker experience.

docker