• Ubuntu 18.04 安装 Docker-ce(就是Docker社区版本)


    一步都不用改,跟着走就行

    1.更换国内软件源,推荐中国科技大学的源,稳定速度快(可选)

    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
    sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
    sudo apt update
    

    2.安装需要的包

    sudo apt install apt-transport-https ca-certificates software-properties-common curl
    

    3.添加 GPG 密钥,并添加 Docker-ce 软件源,这里还是以中国科技大学的 Docker-ce 源为例

    curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu 
    $(lsb_release -cs) stable"
    

    4.添加成功后更新软件包缓存

    sudo apt update
    

    5.安装 Docker-ce

    sudo apt install docker-ce
    

    6.设置开机自启动并启动 Docker-ce(安装成功后默认已设置并启动,可忽略)

    sudo systemctl enable docker
    sudo systemctl start docker
    

    7.测试运行

    sudo docker run hello-world
    

    8.添加当前用户到 docker 用户组,可以不用 sudo 运行 docker(可选)

    sudo groupadd docker
    sudo usermod -aG docker $USER
    

    9.重启docker服务

    sudo systemctl restart docker
    

    10.切换或者退出当前账户再从新登入

    su root             切换到root用户
    su ${USER}          再切换到原来的应用用户以上配置才生效
    

    11.测试添加用户组

    docker run hello-world
    
  • 相关阅读:
    js 小程序获取本周七天
    js 时间处理函数 获取今天的前几天和后几天的任意一天
    路由配置
    3 vue-router 的默认hash 改mode:history去除#号 传参
    Eslint 配置及规则说明(报错)
    打开左侧菜单栏
    sublime 对vue的高亮显示
    gitlab 本地建库配置 config
    GIT 安装
    v-html的应用
  • 原文地址:https://www.cnblogs.com/bihanghang/p/10013352.html
Copyright © 2020-2023  润新知