docker基本命令

# 检查服务状态
[root@iZbp1ajqzkbhcq19bdoswlZ ~]# 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)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 3
 Server Version: 20.10.15
 Storage Driver: overlay2
  Backing Filesystem: xfs
  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:
  seccomp
   Profile: default
 Kernel Version: 4.18.0-193.14.2.el8_2.x86_64
 Operating System: CentOS Linux 8 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.507GiB
 Name: iZbp1ajqzkbhcq19bdoswlZ
 ID: REYK:FQTX:DQZP:KTPE:GWD6:M3TQ:52LK:VB3I:7RYX:PGI6:67I7:VHGN
 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
 Live Restore Enabled: false
检查镜像
[root@iZbp1ajqzkbhcq19bdoswlZ ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED        SIZE
redis         latest    a10f849e1540   2 weeks ago    117MB
nginx         latest    fa5269854a5e   3 weeks ago    142MB
hello-world   latest    feb5d9fea6a5   7 months ago   13.3kB
检查正在运行的docker容器
[root@iZbp1ajqzkbhcq19bdoswlZ ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
# docker运行nginx
[root@iZbp1ajqzkbhcq19bdoswlZ ~]# docker run -d -p 80:80 nginx
1ad73ff6a4e57982e7e2addc9b5d212f297df986b50cbaf30ee5ba489cc17a4f

# 参数解释
docker run 参数 镜像
-d 后台运行
-p 端口映射
nginx 镜像名

posted @ 2022-05-13 10:27  下个ID见  阅读(35)  评论(0)    收藏  举报