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

ubuntu安装docker

时间:2024-05-27 19:33:41浏览次数:28  
标签:... amd64 jammy apt ubuntu docker 安装

官方安装指南

中科大镜像站使用说明

添加仓库源手动安装(官方推荐生产环境安装方式)

官方仓库源手动安装指南
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

可能连接不上download.docker.com,改用国内镜像源,比如中科大,只需要将download.docker.com改成mirrors.ustc.edu.cn/docker-ce即可

修改后的安装步骤和命令
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
安装全过程代码
连接主机...
连接主机成功
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-105-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

  System information as of Mon May 27 11:14:59 AM UTC 2024

  System load:  0.43603515625      Processes:             165
  Usage of /:   17.8% of 27.86GB   Users logged in:       0
  Memory usage: 7%                 IPv4 address for eth0: 192.168.2.101
  Swap usage:   0%


Expanded Security Maintenance for Applications is not enabled.

19 updates can be applied immediately.
To see these additional updates run: apt list --upgradable

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


The list of available updates is more than a week old.
To check for new updates run: sudo apt update

Last login: Fri Apr 19 10:39:51 2024
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

lyh@u1:~$ sudo apt update
Hit:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease                                                 
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease [119 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease [109 kB]
Get:4 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 Packages [1,683 kB]
Get:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main Translation-en [312 kB]
Get:7 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/restricted amd64 Packages [1,933 kB]
Get:8 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/restricted Translation-en [328 kB]  
Get:9 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/universe amd64 Packages [1,075 kB]    
Get:10 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/universe Translation-en [246 kB] 
Get:11 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports/main amd64 Packages [67.1 kB] 
Get:12 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports/universe amd64 Packages [27.2 kB]
Get:13 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports/universe Translation-en [16.2 kB]
Get:14 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1,472 kB]            
Get:15 http://security.ubuntu.com/ubuntu jammy-security/main Translation-en [253 kB]
Get:16 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [1,876 kB]
Get:17 http://security.ubuntu.com/ubuntu jammy-security/restricted Translation-en [318 kB]
Get:18 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [853 kB]
Get:19 http://security.ubuntu.com/ubuntu jammy-security/universe Translation-en [164 kB]
Fetched 11.0 MB in 4s (3,037 kB/s)                               
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
33 packages can be upgraded. Run 'apt list --upgradable' to see them.
lyh@u1:~$ sudo apt-get install ca-certificates curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20230311ubuntu0.22.04.1).
ca-certificates set to manually installed.
curl is already the newest version (7.81.0-1ubuntu1.16).
curl set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 33 not upgraded.
lyh@u1:~$ sudo install -m 0755 -d /etc/apt/keyrings
lyh@u1:~$ sudo curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
lyh@u1:~$ sudo chmod a+r /etc/apt/keyrings/docker.asc
lyh@u1:~$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
lyh@u1:~$ sudo apt-get update
Hit:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease                                                                         
Get:4 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu jammy InRelease [48.8 kB]                 
Hit:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease                                       
Hit:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease                                     
Get:5 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu jammy/stable amd64 Packages [32.8 kB]
Hit:6 http://security.ubuntu.com/ubuntu jammy-security InRelease
Fetched 81.6 kB in 1s (135 kB/s)
Reading package lists... Done
lyh@u1:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  docker-ce-rootless-extras libltdl7 libslirp0 pigz slirp4netns
Suggested packages:
  aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
  containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin libltdl7 libslirp0 pigz
  slirp4netns
0 upgraded, 10 newly installed, 0 to remove and 33 not upgraded.
Need to get 121 MB of archives.
After this operation, 435 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:5 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu jammy/stable amd64 containerd.io amd64 1.6.32-1 [30.0 MB]
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 pigz amd64 2.6-1 [63.6 kB]   
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/main amd64 libltdl7 amd64 2.4.6-15build2 [39.6 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/main amd64 libslirp0 amd64 4.6.1-1build1 [61.5 kB]
Get:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 slirp4netns amd64 1.0.1-2 [28.2 kB]
Get:6 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu jammy/stable amd64 docker-buildx-plugin amd64 0.14.0-1~ubuntu.22.04~jammy [29.7 MB]
Get:7 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu jammy/stable amd64 docker-ce-cli amd64 5:26.1.3-1~ubuntu.22.04~jammy [14.6 MB]
Get:8 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu jammy/stable amd64 docker-ce amd64 5:26.1.3-1~ubuntu.22.04~jammy [25.3 MB]      
Get:9 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu jammy/stable amd64 docker-ce-rootless-extras amd64 5:26.1.3-1~ubuntu.22.04~jammy [9,319 kB]
Get:10 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu jammy/stable amd64 docker-compose-plugin amd64 2.27.0-1~ubuntu.22.04~jammy [12.5 MB]
Fetched 121 MB in 11s (11.1 MB/s)                                                                                                        
Selecting previously unselected package pigz.
(Reading database ... 74559 files and directories currently installed.)
Preparing to unpack .../0-pigz_2.6-1_amd64.deb ...
Unpacking pigz (2.6-1) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../1-containerd.io_1.6.32-1_amd64.deb ...
Unpacking containerd.io (1.6.32-1) ...
Selecting previously unselected package docker-buildx-plugin.
Preparing to unpack .../2-docker-buildx-plugin_0.14.0-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-buildx-plugin (0.14.0-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../3-docker-ce-cli_5%3a26.1.3-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce-cli (5:26.1.3-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../4-docker-ce_5%3a26.1.3-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce (5:26.1.3-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-ce-rootless-extras.
Preparing to unpack .../5-docker-ce-rootless-extras_5%3a26.1.3-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-ce-rootless-extras (5:26.1.3-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package docker-compose-plugin.
Preparing to unpack .../6-docker-compose-plugin_2.27.0-1~ubuntu.22.04~jammy_amd64.deb ...
Unpacking docker-compose-plugin (2.27.0-1~ubuntu.22.04~jammy) ...
Selecting previously unselected package libltdl7:amd64.
Preparing to unpack .../7-libltdl7_2.4.6-15build2_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-15build2) ...
Selecting previously unselected package libslirp0:amd64.
Preparing to unpack .../8-libslirp0_4.6.1-1build1_amd64.deb ...
Unpacking libslirp0:amd64 (4.6.1-1build1) ...
Selecting previously unselected package slirp4netns.
Preparing to unpack .../9-slirp4netns_1.0.1-2_amd64.deb ...
Unpacking slirp4netns (1.0.1-2) ...
Setting up docker-buildx-plugin (0.14.0-1~ubuntu.22.04~jammy) ...
Setting up containerd.io (1.6.32-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Setting up docker-compose-plugin (2.27.0-1~ubuntu.22.04~jammy) ...
Setting up libltdl7:amd64 (2.4.6-15build2) ...
Setting up docker-ce-cli (5:26.1.3-1~ubuntu.22.04~jammy) ...
Setting up libslirp0:amd64 (4.6.1-1build1) ...
Setting up pigz (2.6-1) ...
Setting up docker-ce-rootless-extras (5:26.1.3-1~ubuntu.22.04~jammy) ...
Setting up slirp4netns (1.0.1-2) ...
Setting up docker-ce (5:26.1.3-1~ubuntu.22.04~jammy) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.7) ...
Scanning processes...                                                                                                                     
Scanning linux images...                                                                                                                  

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
lyh@u1:~$ docker --version
Docker version 26.1.3, build b72abbb
lyh@u1:~$ 
                                   

脚本安装(安装源改为中科大)

脚本安装全过程
连接主机...
连接主机成功
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-105-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

  System information as of Mon May 27 10:32:38 AM UTC 2024

  System load:  1.17822265625      Processes:             178
  Usage of /:   17.8% of 27.86GB   Users logged in:       0
  Memory usage: 7%                 IPv4 address for eth0: 192.168.2.101
  Swap usage:   0%


Expanded Security Maintenance for Applications is not enabled.

19 updates can be applied immediately.
To see these additional updates run: apt list --upgradable

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


The list of available updates is more than a week old.
To check for new updates run: sudo apt update

Last login: Fri Apr 19 10:39:51 2024
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

lyh@u1:~$ curl -fsSL https://get.docker.com -o get-docker.sh
lyh@u1:~$ sudo DOWNLOAD_URL=https://mirrors.ustc.edu.cn/docker-ce sh get-docker.sh
[sudo] password for lyh: 
# Executing docker install script, commit: 6d9743e9656cc56f699a64800b098d5ea5a60020
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c install -m 0755 -d /etc/apt/keyrings
+ sh -c curl -fsSL "https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg" -o /etc/apt/keyrings/docker.asc
+ sh -c chmod a+r /etc/apt/keyrings/docker.asc
+ sh -c echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu jammy stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin >/dev/null
+ sh -c docker version
Client: Docker Engine - Community
 Version:           26.1.3
 API version:       1.45
 Go version:        go1.21.10
 Git commit:        b72abbb
 Built:             Thu May 16 08:33:29 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          26.1.3
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.10
  Git commit:       8e96db1
  Built:            Thu May 16 08:33:29 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.32
  GitCommit:        8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

================================================================================

To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:

    dockerd-rootless-setuptool.sh install

Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.


To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/

WARNING: Access to the remote API on a privileged Docker daemon is equivalent
         to root access on the host. Refer to the 'Docker daemon attack surface'
         documentation for details: https://docs.docker.com/go/attack-surface/

================================================================================

lyh@u1:~$ 

标签:...,amd64,jammy,apt,ubuntu,docker,安装
From: https://www.cnblogs.com/aiparallelworld/p/18216320

相关文章

  • android studio2024最新详解(完全小白)安装-运行第一个程序
    前面我用2023最新版本的,死活就卡在引入依赖那里卡了两天,俺的崩溃谁知啊!! 后面我就换了个思维,看着网上大多的教程都是基于2022或者2020的,我就找了个看起来非常详细的视频,里面的是2020的,所以我就下载了2020。  有点小伙伴可能会找不到androidstudio的过往版本,这里我就直......
  • ubuntu java版本间切换
    今天在编译rk3288安卓5.1时出错,提示需要java1.7.x版本的jdk,而我的ubuntu默认已经安装了java 1.8.0_362版本,下面介绍下我是如何进行java版本切换的。1.从官网上下载得到java 1.7.0_80压缩包(找个QQ邮箱注册账号后就可以直接下载了)https://www.oracle.com/java/technol......
  • Windows系统使用Docker部署Focalboard团队协作工具详细流程
    文章目录前言1.使用Docker本地部署Focalboard1.1在Windows中安装Docker1.2使用Docker部署Focalboard2.安装Cpolar内网穿透工具3.实现公网访问Focalboard4.固定Focalboard公网地址前言本篇文章将介绍如何使用Docker本地部署Focalboard项目管理工具,并且结合cp......
  • Centos 7 安装刻录至服务器
    前言在日常测试中,会遇到很多安装的场景,今天给大家讲一下centos7的安装,希望对大家有所帮助。一.下载镜像地址如下:centos官方镜像下载地址https://www.centos.org/download/按照需求依次点击下载二.镜像刻录镜像刻录至u盘,可以使用UltraISO这个工具,详细用法可参考......
  • 源码编译安装LAMP
    目录1.Apache网站服务2.MySQL服务3.PHP服务4.LAMP架构应用实例LAMP:网站服务架构同时提供静态页面和动态页面能力Linux:提供网站服务应用的运行环境,也支持Windows作为AMP的运行环境Apache:作为前端网站服务,直接面向用户提供网站访问入口,并处理静态页面请求MySQL:作为后端......
  • Linux用docker安装Elasticsearch&&SpringBoot整合ES
    一. 部署Elasticsearch1.docker查询docker容器中的esdockersearchelasticsearch2. 安装(PS:查看自己的springBoot的版本号 对应的es版本安装)dockerpullelasticsearch:7.6.23.查看已安装的docker镜像dockerimages4.创建挂在目录mkdir-p/data/elk/es/{......
  • portainer及agent 安装教程
    1.简介Portainer是一个强大的开源工具,用于管理Docker环境。它提供了一个直观的Web界面,简化了容器的管理过程。在这篇博客中,我们将介绍如何部署Portainer及其Agent。2.PortainerServer首先,我们需要在主机上部署PortainerServer。它提供了一个Web界面,用于管理Dock......
  • centos 7 安装mysql5.7
    1.在线安装,有时安装失败,可能是自动选择镜像时问题sudoyumlocalinstallhttps://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpmsudoyuminstallmysql-community-servermysql-community-client启动mysql:sudosystemctlstartmysqld停止mysql:sudo......
  • DockerUI结合cpolar内网穿透远程管理维护本地docker和swarm集群
    文章目录......
  • 【C++】开源:RabbitMQ安装与配置使用(SimpleAmqpClient)
    ......