ubuntu22 安装docker26

ubuntu22 安装docker

在Ubuntu 22.04上安装Docker,你可以按照以下步骤操作:

  • 1.更新软件包索引:
sudo apt-get update
  • 2.允许APT使用HTTPS:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
  • 3.添加Docker官方GPG密钥:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • 4.添加Docker的稳定版本仓库:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  • 5.再次更新软件包索引:

sudo apt-get update
  • 6.安装Docker CE(社区版):

sudo apt-get install docker-ce
  • 7.验证Docker是否安装成功并运行:

sudo systemctl status docker
root@iZuf60jtbmtn8dpsl8szetZ:~# sudo systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-05-10 10:16:07 CST; 57s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 5203 (dockerd)
      Tasks: 9
     Memory: 29.8M
     CGroup: /system.slice/docker.service
             └─5203 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

May 10 10:16:06 iZuf60jtbmtn8dpsl8szetZ systemd[1]: Starting Docker Application Container Engine...
May 10 10:16:06 iZuf60jtbmtn8dpsl8szetZ dockerd[5203]: time="2024-05-10T10:16:06.972071844+08:00" level=info msg="Starting up"
May 10 10:16:06 iZuf60jtbmtn8dpsl8szetZ dockerd[5203]: time="2024-05-10T10:16:06.974249844+08:00" level=info msg="detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/sys>
May 10 10:16:07 iZuf60jtbmtn8dpsl8szetZ dockerd[5203]: time="2024-05-10T10:16:07.060158894+08:00" level=info msg="Loading containers: start."
May 10 10:16:07 iZuf60jtbmtn8dpsl8szetZ dockerd[5203]: time="2024-05-10T10:16:07.260502983+08:00" level=info msg="Loading containers: done."
May 10 10:16:07 iZuf60jtbmtn8dpsl8szetZ dockerd[5203]: time="2024-05-10T10:16:07.274657654+08:00" level=warning msg="WARNING: No swap limit support"
May 10 10:16:07 iZuf60jtbmtn8dpsl8szetZ dockerd[5203]: time="2024-05-10T10:16:07.274846519+08:00" level=info msg="Docker daemon" commit=ef1912d containerd-snapshotter=false storage-driver=overlay2 versio>
May 10 10:16:07 iZuf60jtbmtn8dpsl8szetZ dockerd[5203]: time="2024-05-10T10:16:07.274985476+08:00" level=info msg="Daemon has completed initialization"
May 10 10:16:07 iZuf60jtbmtn8dpsl8szetZ dockerd[5203]: time="2024-05-10T10:16:07.312326687+08:00" level=info msg="API listen on /run/docker.sock"
May 10 10:16:07 iZuf60jtbmtn8dpsl8szetZ systemd[1]: Started Docker Application Container Engine.

或者使用简单的命令检查Docker版本:docker --version

如果需要非root用户也能运行Docker命令,可以将用户添加到docker组:

sudo usermod -aG docker ${USER}

需要注销并重新登录或重新启动以使组变更生效。

AI如此强大,你不改变就要被变革

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值