📜  docker setup - Shell-Bash (1)

📅  最后修改于: 2023-12-03 14:40:49.752000             🧑  作者: Mango

Docker Setup - Shell/Bash

Introduction

Docker is an open-source platform that allows developers to automate the deployment and scaling of applications inside software containers. It provides an efficient and lightweight way to package, distribute, and run applications with their dependencies.

This guide will walk you through the setup process of Docker using the Shell/Bash scripting language.

Prerequisites

Before getting started, ensure that your system meets the following prerequisites:

  • Operating System: Linux, macOS, or Windows 10 Pro or Enterprise edition
  • Shell/Bash environment
Steps to Install Docker

Follow these steps to install Docker on your system:

  1. Update your package index:

    sudo apt update
    
  2. Install the required dependencies:

    sudo apt install apt-transport-https ca-certificates curl software-properties-common
    
  3. Add Docker's official GPG key:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    
  4. Add Docker's stable repository:

    echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    
  5. Update the package index again:

    sudo apt update
    
  6. Install Docker:

    sudo apt install docker-ce docker-ce-cli containerd.io
    
  7. Verify the installation:

    sudo docker run hello-world
    

If the installation is successful, you should see a "Hello from Docker!" message.

Post-Installation Steps

After installing Docker, you may want to perform some additional steps:

  1. Manage Docker as a non-root user:

    sudo usermod -aG docker $USER
    

    Remember to log out and log back in for the changes to take effect.

  2. Configure Docker to start on boot:

    sudo systemctl enable docker
    
  3. Explore Docker documentation and start using Docker to create, run, and manage containers. Here are some useful resources:

Conclusion

Congratulations! You have successfully set up Docker on your system using Shell/Bash scripting. Now you can harness the power of Docker to easily manage your application deployments and streamline your development workflow. Happy containerization!

Note: Make sure to refer to the official Docker documentation for more detailed information and advanced usage examples.