基于Ubuntu操作系统下的Docker 环境部署

简介: Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中,然后发布到任何流行的 Linux或Windows操作系统的机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。

Docker 支持以下Ubuntu 版本

Ubuntu Jammy 22.04 (LTS)
Ubuntu Impish 21.10
Ubuntu Focal 20.04 (LTS)
Ubuntu Bionic 18.04 (LTS)
一、更新 Ubuntu apt包
sudo apt-get update
二、安装 apt 依赖包,用于通过HTTPS来获取仓库:

sudo apt-get update

$ sudo apt-get install \

ca-certificates \
curl \
gnupg \
lsb-release

三、添加 Docker 的官方 GPG 密钥:

sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
四、设置 repository

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
安装 Docker Engine-Community
更新 apt 包索引。

$ sudo apt-get update
安装最新版本的 Docker Engine-Community 和 containerd ,或者转到下一步安装特定版本:

$ sudo apt-get install docker-ce docker-ce-cli containerd.io
要安装特定版本的 Docker Engine-Community,请在仓库中列出可用版本,然后选择一种安装。列出您的仓库中可用的版本:

$ apt-cache madison docker-ce

docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 5:18.09.0~3-0~ubuntu-xenial | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 18.06.1~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 18.06.0~ce~3-0~ubuntu | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu xenial/stable amd64 Packages
...

使用第二列中的版本字符串安装特定版本,例如 5:18.09.1~3-0~ubuntu-xenial。

$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
测试 Docker 是否安装成功,输入以下指令,打印出以下信息则安装成功:

$ sudo docker run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
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/

目录
相关文章
|
2天前
|
安全 Linux 网络安全
部署07--远程连接Linux系统,利用FinalShell可以远程连接到我们的操作系统上
部署07--远程连接Linux系统,利用FinalShell可以远程连接到我们的操作系统上
|
2天前
|
Linux 虚拟化 数据安全/隐私保护
部署05-VMwareWorkstation中安装CentOS7 Linux操作系统, VMware部署CentOS系统第一步,下载Linux系统,/不要忘, CentOS -7-x86_64-DVD
部署05-VMwareWorkstation中安装CentOS7 Linux操作系统, VMware部署CentOS系统第一步,下载Linux系统,/不要忘, CentOS -7-x86_64-DVD
|
2天前
|
消息中间件 编解码 Docker
Docker部署RabbitMQ消息中间件
【7月更文挑战第4天】Docker部署RabbitMQ消息中间件
19 3
|
4天前
|
消息中间件 数据可视化 RocketMQ
【RocketMQ系列二】通过docker部署单机RocketMQ
【RocketMQ系列二】通过docker部署单机RocketMQ
16 4
|
7天前
|
Nacos 数据中心 Docker
Docker 部署 Nacos 集群
Docker 部署 Nacos 集群
|
11天前
|
Ubuntu Docker 容器
ubuntu安装docker
ubuntu安装docker
141 1
|
2天前
|
Ubuntu 持续交付 Docker
如何在 Ubuntu 20.04 上安装 Docker和DockerCompose
如何在 Ubuntu 20.04 上安装 Docker和DockerCompose
43 0
|
2天前
|
Linux
部署09--虚拟机快照,我们无法避免损坏Linux操作系统 ,如果重新装一下就太过麻烦,推荐在关机下制作快照,关机制作效率好,机房要靠近地址,动不动崩溃
部署09--虚拟机快照,我们无法避免损坏Linux操作系统 ,如果重新装一下就太过麻烦,推荐在关机下制作快照,关机制作效率好,机房要靠近地址,动不动崩溃
|
2天前
|
Linux 调度
部署03---Linux操作系统的诞生,Linux操作系统由系统的内核和系统的操作系统所组成
部署03---Linux操作系统的诞生,Linux操作系统由系统的内核和系统的操作系统所组成
|
2天前
|
Linux 调度
部署02-我们一般接触的是Mos和Wimdows这两款操作系统,很少接触到Linux,操作系统的概述,硬件是由计算机系统中由电子和机械,光电元件所组成的,CPU,内存,硬盘,软件是用户与计算机接口之间
部署02-我们一般接触的是Mos和Wimdows这两款操作系统,很少接触到Linux,操作系统的概述,硬件是由计算机系统中由电子和机械,光电元件所组成的,CPU,内存,硬盘,软件是用户与计算机接口之间