码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Ubuntu20.04安装Docker


    文章目录

      • 一、卸载旧版本Docker
      • 二、设置Docker仓库
        • 2.1 更新apt包索引
        • 2.2 安装Docker依赖
        • 2.3 添加GPG密钥
        • 2.4 设置仓库
      • 三、 安装docker Engine-Community
        • 3.1 安装最新版本
        • 3.2 安装特定版本
      • 四、测试

    一、卸载旧版本Docker

    在终端输入:(下面也是)

    sudo apt-get remove docker docker-engine docker.io containerd runc
    
    • 1

    二、设置Docker仓库

    2.1 更新apt包索引

    sudo apt-get update
    
    • 1

    2.2 安装Docker依赖

     sudo apt-get install \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg-agent \
        software-properties-common
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    2.3 添加GPG密钥

    curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
    
    • 1

    2.4 设置仓库

     sudo add-apt-repository \
       "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
      $(lsb_release -cs) \
      stable"
    
    • 1
    • 2
    • 3
    • 4

    三、 安装docker Engine-Community

    3.1 安装最新版本

    sudo apt-get install docker-ce docker-ce-cli containerd.io
    
    • 1

    3.2 安装特定版本

    sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
    
    • 1

    四、测试

    我们跑一个hello-world 镜像试试

    docker run hello-world
    
    • 1

    这个命令首先会在本地查找有无该容器,如果没有则去docker 的镜像仓库查找
    如果反馈如下,则安装成功:

    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    2db29710123e: Pull complete
    Digest: sha256:13e367d31ae85359f42d637adf6da428f76d75dc9afeb3c21faea0d976f5c651
    Status: Downloaded newer image for hello-world:latest
    
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (amd64)
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    
    Share images, automate workflows, and more with a free Docker ID:
     https://hub.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/get-started/
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    接下来就是正式的使用Docker容器化部署了

  • 相关阅读:
    重磅!这本30w人都在看的Python数据分析畅销书:更新了!
    java.io.IOException: Broken pipe
    图像的SIFT特征点提取
    Electron[1] 缘起桌面应用
    【设计模式】访问者模式
    Apache Doris系列之:安装与部署详细步骤
    ARM Cortex-M3从汇编到C,从Boot到应用的教程
    MySQL游标
    CodeForces刷题C语言:Army、Blinds、Cubical Planet、Find Color、Translation
    Redis-事务/持久化
  • 原文地址:https://blog.csdn.net/m0_46201544/article/details/125451788
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号