史上最全 Docker 环境安装指南

本贴最后更新于 1575 天前,其中的信息可能已经斗转星移

一、思考❓❔

1.什么是Docker?

image.png


2.安装Docker难不难?

image.png



二、Windows上安装Docker??

image.png

1.在Windows 10上安装Docker

操作系统 内存 其他
Windows 10 64 bit (家庭版不行) 4GB以上 开启Hyper-V(大多数电脑默认会开启)




2.在Windows 老版本安装Docker

操作系统 内存 其他
Windows 7 , 8, 8.1 4GB以上 开启Hyper-V(大多数电脑默认会开启)


image.png




三、在Linux上安装Docker????

image.png

1.在Centos上安装








2.在Ubuntu上安装



# 更新apt包索引
sudo apt-get update

# 安装docker
sudo apt-get install docker-ce docker-ce-cli containerd.io





四、使用shell脚本安装Docker??

1.在Ubuntu和Centos上安装

install_docker_.sh

#!/bin/bash
#Author: 柠檬班可优
#Date: 2019-06-06
#install docker in ubuntu and centos


function install_docker_in_ubuntu
{
    sudo  apt-get update -y
    # install some tools
    sudo apt-get install \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg-agent \
        software-properties-common \
        net-tools \
        wget -y

    # install docker
    curl -fsSL get.docker.com -o get-docker.sh
    sh get-docker.sh

    # start docker service
    sudo groupadd docker &> /dev/null
    sudo gpasswd -a "${USER}" docker
    sudo systemctl start docker

    rm -rf get-docker.sh
}


function install_docker_in_centos
{
    # install some tools
    sudo yum install -y git vim gcc glibc-static telnet bridge-utils

    # install docker
    curl -fsSL get.docker.com -o get-docker.sh
    sh get-docker.sh

    # start docker service
    sudo groupadd docker &> /dev/null
    sudo gpasswd -a "${USER}" docker
    sudo systemctl start docker

    rm -rf get-docker.sh

}


SYSTEM_NAME="$(awk -F= '/^NAME/{print $2}' /etc/os-release)"
if [[ "${SYSTEM_NAME,,}" =~ "ubuntu"  ]] ; then
    echo "Your system is ubuntu."
    echo "Installing Docker in ubuntu..."
    install_docker_in_ubuntu
elif [[ "${SYSTEM_NAME,,}" =~ "centos" ]] ; then
    echo "Your system is centos."
    echo "Installing Docker in centos..."
    install_docker_in_centos
else
    echo "This script can only run in ubuntu and centos system."
    exit 1
fi

2.运行脚本



五、在线练习docker??



六、总结??

image.png

image.png

2 回帖
请输入回帖内容 ...
  • kiihaa

    666写得真棒!赞赞赞!!!

  • mrw

    厉害,楼主,点赞