首页 > 系统相关 >ubuntu安装docker

ubuntu安装docker

时间:2023-04-29 22:04:16浏览次数:29  
标签:get sudo apt https ubuntu docker 安装 Docker

  1. 卸载旧版 Docker(可选):
sudo apt-get remove docker docker-engine docker.io containerd runc
  1. 更新 apt 包索引并安装依赖:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
  1. 添加 Docker 的官方 GPG 密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  1. 添加 Docker 包存储库:
echo "deb [arch=amd64 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
  1. 更新 apt 包索引再次进行安装:
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
  1. (可选)添加当前用户到 docker 用户组:
sudo usermod -aG docker $USER
  1. (可选)启动 Docker 服务:
sudo systemctl start docker

现在,Docker 已安装并准备好在 Ubuntu 上运行容器。您可以通过使用 docker 命令在终端中管理容器和镜像。

  1. 测试
echohye@echohye-virtual-machine:~/桌面$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:4e83453afed1b4fa1a3500525091dbfca6ce1e66903fd4c01ff015dbcb1ba33e
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/

箴言:因为这些东西是非常简单的。不要抱怨自己学不会,那是因为你没有足够用心。



标签:get,sudo,apt,https,ubuntu,docker,安装,Docker
From: https://blog.51cto.com/echohye/6236951

相关文章

  • ubuntu运行vite项目,出现端口无权限
    npmrundev>[email protected]>viteerrorwhenstartingdevserver:Error:listenEACCES:permissiondenied0.0.0.0:86atServer.setupListenHandle[as_listen2](node:net:1723:21)atlistenInCluster(node:net:1788:12)atServer......
  • ubuntu安装nodejs 14
    nodejs的每个大版本号都有相对应的源,比如这里的10.x.x版本的源是https://deb.nodesource.com/setup_10.x。所以在终端执行:curl-sLhttps://deb.nodesource.com/setup_18.x|sudo-Ebash-点击查看命令解释这个命令是用来添加Node.js18.x的仓库地址。具体来说,它通过curl......
  • Ubuntu 发行版更新 Linux 内核,修复 17 个安全漏洞
    IT之家近日消息,Canonical于今天面向所有处于支持状态的Ubuntu发行版,发布了 Linux 内核安全更新,累计修复了17个安全漏洞。IT之家近日消息,Canonical于今天面向所有处于支持状态的Ubuntu发行版,发布了Linux内核安全更新,累计修复了17个安全漏洞。本次更新适用于......
  • Ubuntu 发行版更新 Linux 内核,修复 17 个安全漏洞
    IT之家近日消息,Canonical于今天面向所有处于支持状态的Ubuntu发行版,发布了 Linux 内核安全更新,累计修复了17个安全漏洞。IT之家近日消息,Canonical于今天面向所有处于支持状态的Ubuntu发行版,发布了Linux内核安全更新,累计修复了17个安全漏洞。本次更新适用于......
  • Ubuntu 发行版更新 Linux 内核,修复 17 个安全漏洞
    IT之家近日消息,Canonical于今天面向所有处于支持状态的Ubuntu发行版,发布了 Linux 内核安全更新,累计修复了17个安全漏洞。IT之家近日消息,Canonical于今天面向所有处于支持状态的Ubuntu发行版,发布了Linux内核安全更新,累计修复了17个安全漏洞。本次更新适用于......
  • 在VMWare上安装群晖DS918+ 7.0系统
    多图预警首先要下载引导文件、系统文件以及相关工具https://cowtransfer.com/s/8925a225faa940点击链接查看[DS918+7.0],或访问奶牛快传cowtransfer.com输入传输口令xinjil查看;引导文件转换引导文件为了在虚拟机中使用群晖的引导,第一步要做的就是转换文件格式,VMWa......
  • python+playwright 学习-55 在docker 容器中运行playwright脚本
    前言Dockerfile.focal可用于在Docker环境中运行Playwright脚本。这些镜像包括在Docker容器中运行浏览器所需的所有依赖项,还包括浏览器本身。playwright在linux系统上目前只支持Ubuntu系统的部分版本,centos和debian系统上是没法运行的。镜像查看所有可用的图像标签https:......
  • [Linux]debian 安装 TightVNC
    1.首先安装TightVNCsudoapt-getinstalltightvncserver2.配置TightVNCtightvncserver:13.启动VNC服务器tightvncserver-geometry1024x600:1然后就可以通过VNC本地端来访问了。在软件里填入ip:1,输入密码即可访问......
  • [Linux]raspbian安装xrdp(远程桌面)
    1.首先换源:输入以下命令sudosed-i"s@http://deb.debian.org@https://mirrors.163.com@g"/etc/apt/sources.list2.update是更新软件列表,upgrade是更新软件。这两个命令一般是一起使用的。3.需要在Debian系统中安装xrdp,xrdpisadaemonthatsupportsMicrosoft'sRemoteD......
  • 使用docker快速安装minio
    1.拉取minio镜像dockerpullminio/minio2.docker容器构建和运行miniodockerrun-d--nameminio\--restart=always\-p9000:9000\-p9001:9001\-e"MINIO_ROOT_USER=minioroot"\-e"MINIO_ROOT_PASSWORD=minioroot"\-v/home/mi......