docker的安装

# 安装
​
ubuntu@ubuntu:~$ curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
​
# 查看版本信息
​
ubuntu@ubuntu:~$ docker --version
​
Docker version 20.10.15, build fd82621
​
ubuntu@ubuntu:~$ docker version
​
Client: Docker Engine - Community
 Version:           20.10.15
 API version:       1.41
 Go version:        go1.17.9
 Git commit:        fd82621
 Built:             Thu May  5 13:19:23 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
​
Server: Docker Engine - Community
 Engine:
  Version:          20.10.15
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.9
  Git commit:       4433bf6
  Built:            Thu May  5 13:17:28 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.4
  GitCommit:        212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc:
  Version:          1.1.1
  GitCommit:        v1.1.1-0-g52de29d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
​
​

常用配置

# 1 建立建立deamon.json
​
ubuntu@ubuntu:~$ docker --version
​
# 在文件中写入如下内容:
​
{
        "registry-mirrors": [
                "https://docker.mirrors.ustc.edu.cn"
        ]
}
​
# 查看deamon.json文件
​
ubuntu@ubuntu:~$ cat /etc/docker/daemon.json

# 2 加载并重新启动服务
​
ubuntu@ubuntu:~$ sudo systemctl reload docker
​
ubuntu@ubuntu:~$ sudo systemctl restart docker
​
ubuntu@ubuntu:~$ sudo service docker status
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-05-10 22:19:52 CST; 18min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 1136 (dockerd)
      Tasks: 9
     Memory: 110.9M
     CGroup: /system.slice/docker.service
             └─1136 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
​
May 10 22:19:51 ubuntu dockerd[1136]: time="2022-05-10T22:19:51.602971851+08:00" level=warning msg="Your kernel does n>
May 10 22:19:51 ubuntu dockerd[1136]: time="2022-05-10T22:19:51.602984540+08:00" level=warning msg="Your kernel does n>
May 10 22:19:51 ubuntu dockerd[1136]: time="2022-05-10T22:19:51.602992211+08:00" level=warning msg="Your kernel does n>
May 10 22:19:51 ubuntu dockerd[1136]: time="2022-05-10T22:19:51.603990163+08:00" level=info msg="Loading containers: s>
May 10 22:19:52 ubuntu dockerd[1136]: time="2022-05-10T22:19:52.178808452+08:00" level=info msg="Default bridge (docke>
May 10 22:19:52 ubuntu dockerd[1136]: time="2022-05-10T22:19:52.219926943+08:00" level=info msg="Loading containers: d>
May 10 22:19:52 ubuntu dockerd[1136]: time="2022-05-10T22:19:52.582513238+08:00" level=info msg="Docker daemon" commit>
May 10 22:19:52 ubuntu dockerd[1136]: time="2022-05-10T22:19:52.602765204+08:00" level=info msg="Daemon has completed >
May 10 22:19:52 ubuntu systemd[1]: Started Docker Application Container Engine.
May 10 22:19:52 ubuntu dockerd[1136]: time="2022-05-10T22:19:52.786136718+08:00" level=info msg="API listen on /run/do>
# 3 使用docker info可以看到相关的信息
​
ubuntu@ubuntu:~$ sudo docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  compose: Docker Compose (Docker Inc., v2.5.0)
  scan: Docker Scan (Docker Inc., v0.17.0)
​
Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.15
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc version: v1.1.1-0-g52de29d
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.4.0-109-generic
 Operating System: Ubuntu 20.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 1.844GiB
 Name: ubuntu
 ID: KYBX:6NJ7:MS6O:PSGY:S2LV:WU2N:3H6H:46UU:3YQW:JGM3:MV54:VHIX
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://docker.mirrors.ustc.edu.cn/
 Live Restore Enabled: false
​
WARNING: No swap limit support
​
`注意:操作docker时,必须有root组或docker组的权限,所以很多命令前需要使用sudo。`
​
# 4 免sudo方法
​
ubuntu@ubuntu:~$ sudo gpasswd -a ${USER} docker
Adding user ubuntu to group docker
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值