Jump to content

How to set up and use Docker Desktop on Windows


The AchieVer

Recommended Posts

Are you a developer and getting started with containerization? Containerization is the new trend these days and it makes your existing application system-independent and more reliable. If you are just a beginner and getting started with tools like Docker, then this is the right place to be at. In this post, we have covered a tutorial on how to set up and use Docker on a Windows machine. The process assumes that you are somewhat familiar with the concept of containerization.

To give you a clearer definition of a container, I would directly like to quote Docker:

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

Set up & use Docker Desktop on Windows

Docker has quite a lot of use case. The most popular of them being containerization of existing applications. You can repackage your existing Java or .NET applications in a highly portable container that can be deployed to any server. But to do that, you need to get through the basics of it. So let’s get started and see how to set it up on Windows.

1. Download and install the setup. Head over to Docker’s website and download Docker Desktop for Windows. Once downloaded, install it on your computer by following the simple instructions in the setup. Your computer might restart a few times during the process.

Docker Desktop on Windows

2. Once everything is installed, you need to create an account. Head over to hub.docker.com and create a new account. Now use the same account to login into you installation on Windows. Creating an account is totally free and you won’t be charged anything.

Docker-SignIn-339x600.png

3. The setup part is now over. You can confirm if Docker is running by going to system tray and clicking on the whale icon. Or you can open a CMD window and execute

docker --version

to check if you have Docker installed on your computer. Or you can also download the hello-world image to check if everything is working fine. In the same CMD window execute docker run hello-world to run all the checks.

 

4. Now you need an image to start your first container. There are a lot of public images available for different purposes. You can go to Docker hub and search for any image that you would like. There are images available for WordPress, Ubuntu, Node.Js etc. In this example, we are going to install a WordPress image on a local container so that you can run a local WordPress container on your computer.

Docker-Hello-World-600x348.png

5. The first step of creating any container is creating its configuration file. The configuration file specifies what image the container will use and with what parameters. So, create a new folder and inside that folder create a new file called docker-compose.yml. Paste the following contents into it and save the file:

version: '3.3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
volumes:
    db_data: {}

Source: Docker Documentation

6. Open a CMD window in this folder and execute

docker-compose up -d

to start downloading the images and setting up the container on your local machine. Once the command finishes execution, you will have a WordPress container up and running on your local machine. You can open it up in your browser by going to http://localhost:8000.

This was how you can create a configuration file and then download the required things for running your application inside a container. Remember that, there are tons of other possibilities available and this post is here to only give you an overview of Docker and containerization. You can search the internet for more configuration files or you can even create your own. There are a lot of free open-source Docker images available online that can get you started.

 

Once you’ve customized your image and made the necessary changes, you can also push it to a Docker Hub repository. Click here to download Docker Desktop for Windows. Further reading about Docker for Windows here.

 

source

Link to comment
Share on other sites


  • Replies 1
  • Views 863
  • Created
  • Last Reply

The same can be achieved with a more friendly user interface like Embarcadero RAD Studio (it packages everything it needs inside the PE and comile for Win/Android/iOS/Linux in 32 and 64 bit flavors with a single code)... and you can get it for free (digging a little bit).

Lazarus can be another option (this is free for real), but it lacks some useful components.

Link to comment
Share on other sites


Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...