Setting Up Docker 🛠️

Introduction to Docker 🐳
Setting Up Docker 🛠️

Now that you’ve been introduced to Docker and its key concepts, it’s time to get your hands dirty! In this lesson, we’ll guide you through the process of setting up Docker on your machine. Whether you’re using Windows, macOS, or Linux, we’ve got you covered.

Installation Guide for Different Operating Systems

1. Installing Docker on Windows

To install Docker on Windows, follow these steps:

  1. System Requirements: Ensure your system meets the requirements. Docker Desktop for Windows requires Windows 10 or 11 with the WSL 2 feature enabled.
  2. Download Docker Desktop: Visit the official Docker website and download Docker Desktop for Windows.
  3. Install Docker Desktop:
  • Run the installer and follow the on-screen instructions.
  • During installation, ensure that the option to use WSL 2 is selected.
  • Once the installation is complete, Docker Desktop will start automatically.
  1. Verify the Installation:
  • Open PowerShell or Command Prompt.
  • Type the command docker --version to check the installed version of Docker.
  • Run docker run hello-world to verify that Docker is working correctly. If you see a “Hello from Docker!” message, you’re all set!

2. Installing Docker on macOS

To set up Docker on macOS:

  1. System Requirements: Docker Desktop for macOS requires macOS 10.15 or newer.
  2. Download Docker Desktop: Head to the Docker website and download Docker Desktop for Mac.
  3. Install Docker Desktop:
  • Open the downloaded .dmg file and drag the Docker icon to your Applications folder.
  • Launch Docker from the Applications folder.
  • Docker Desktop will prompt you to enter your password to finish the installation.
  1. Verify the Installation:
  • Open Terminal.
  • Type docker --version to check the installed version of Docker.
  • Run docker run hello-world to ensure Docker is functioning properly. If successful, you’ll see a confirmation message from Docker.

3. Installing Docker on Linux

For Linux users, here’s how to install Docker:

  1. System Requirements: Docker can be installed on various Linux distributions, including Ubuntu, CentOS, and Fedora.
  2. Install Docker:
  • Open a terminal window.
  • Update your package index with the command:
    sudo apt-get update
  • Install Docker using the following command:
    sudo apt-get install docker-ce docker-ce-cli containerd.io
  • Start the Docker service:
    sudo systemctl start docker
  • Enable Docker to start on boot:
    sudo systemctl enable docker
  1. Verify the Installation:
  • Check the installed version with:
    docker --version
  • Test your installation by running:
    sudo docker run hello-world
  • If you see the “Hello from Docker!” message, your installation was successful!

Basic Docker Commands and Tools

With Docker now installed, let’s get familiar with some basic Docker commands. These commands will help you navigate and manage your Docker environment.

  1. docker --version: Check the installed Docker version.
  2. docker pull [image_name]: Download a Docker image from Docker Hub (e.g., docker pull nginx).
  3. docker run [image_name]: Run a container from an image (e.g., docker run nginx).
  4. docker ps: List all running containers.
  5. docker stop [container_id]: Stop a running container.
  6. docker rm [container_id]: Remove a container.
  7. docker images: List all downloaded Docker images.
  8. docker rmi [image_id]: Remove a Docker image.

Next Steps: Diving Deeper into Docker

Now that Docker is up and running on your machine, you’re ready to start exploring its capabilities. In the next lesson, we’ll delve into Docker images and containers, showing you how to build, run, and manage them efficiently.

So, take a moment to familiarize yourself with these commands, and let’s keep the momentum going! 🚀

Next lesson: Understanding Docker images and containers

This lesson is part of the FREE full course

Docker & Kubernetes Essentials: Your Path to Modern DevSecOps

Similar Posts