日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網為廣大站長提供免費收錄網站服務,提交前請做好本站友鏈:【 網站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

說明:把Docker常用命令歸納到linux基礎,是因為我本地docker安裝在centos上,平時運行實驗鏡像的時候都是直接在centos上操作運行。

1、docker版本、狀態查看

[root@k8smaster test]# docker -v
Docker version 20.10.6, build 370c289
[root@k8smaster test]# docker version
Client: Docker Engine - Community
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        370c289
 Built:             Fri Apr  9 22:45:33 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
......
......

2、鏡像(image)操作

從倉庫拉取鏡像:

//  Docker的鏡像存儲在鏡像注冊中心(image registry)中,默認是Docker Hub(https://hub.docker.com/),在拉取鏡像的時候也可以指定其它注冊中心。
//  拉取鏡像,使用docker image pull命令
[root@k8smaster test]# docker image pull --help

Usage:  docker image pull [OPTIONS] NAME[:TAG|@DIGEST]

Pull an image or a repository from a registry

Options:
  -a, --all-tags                Download all tagged images in the repository
      --disable-content-trust   Skip image verification (default true)
      --platform string         Set platform if server is
                                multi-platform capable
  -q, --quiet                   Suppress verbose output

查詢已有鏡像:

[root@k8smaster test]# docker image ls
REPOSITORY    TAG       IMAGE ID       CREATED        SIZE
hello-world   latest    d1165f221234   2 months ago   13.3kB

刪除鏡像:

[root@k8smaster test]# docker rmi --help

Usage:  docker rmi [OPTIONS] IMAGE [IMAGE...]

Remove one or more images

Options:
  -f, --force      Force removal of the image
      --no-prune   Do not delete untagged parents
[root@k8smaster test]# docker rmi -f hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c
Deleted: sha256:d1165f2212346b2bab48cb01c1e39ee8ad1be46b87873d9ca7a4e434980a7726
[root@k8smaster test]# docker image ls
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

刪除所有的鏡像:

[root@k8smaster test]# docker rmi $(docker images -q)

3、容器(container)操作

運行容器:

// -d 后臺運行 -it交互模式  -p端口映射 --name命名
[root@k8smaster io-cached]# docker run --privileged --name=App -itd feisky/app:io-cached
742cd266966a35af9088b842c4f607e767a8578b7feb2d29ccf0154986e56f05

容器運行日志查看(用于驗證容器是否已經運行):

[root@k8smaster io-cached]# docker logs app
Reading data from disk /dev/sda2 with buffer size 33554432
Time used: 0.410266 s to read 33554432 bytes
Time used: 0.011844 s to read 33554432 bytes
Time used: 0.011292 s to read 33554432 bytes
Time used: 0.011079 s to read 33554432 bytes
Time used: 0.011068 s to read 33554432 bytes
Time used: 0.010529 s to read 33554432 bytes
Time used: 0.011277 s to read 33554432 bytes

查看運行中的容器:

[root@k8smaster io-cached]# docker ps
CONTAINER ID   IMAGE                  COMMAND   CREATED         STATUS         PORTS     NAMES
5017ff0bc9a6   feisky/app:io-direct   "/app"    5 minutes ago   Up 5 minutes             app

暫停、重啟、刪除容器:

[root@k8smaster io-cached]# docker stop app
app
[root@k8smaster io-cached]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@k8smaster io-cached]# docker start app
app
[root@k8smaster io-cached]# docker ps
CONTAINER ID   IMAGE                  COMMAND   CREATED         STATUS         PORTS     NAMES
742cd266966a   feisky/app:io-cached   "/app"    3 minutes ago   Up 4 seconds             app
[root@k8smaster io-cached]# docker rm -f app
app
[root@k8smaster io-cached]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

停止或刪除所有容器:

[root@k8smaster io-cached]# docker stop $(docker ps -qa)

[root@k8smaster io-cached]# docker rm -f $(docker ps -aq)
[root@k8smaster io-cached]# docker rm -f $(docker stop $(docker ps -q))

4、進入交互模式

[root@k8smaster io-cached]# docker exec -it app /bin/bash
[root@k8smaster io-cached]# docker exec -it app /bin/sh

分享到:
標簽:docker
用戶無頭像

網友整理

注冊時間:

網站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網站吧!
最新入駐小程序

數獨大挑戰2018-06-03

數獨一種數學游戲,玩家需要根據9

答題星2018-06-03

您可以通過答題星輕松地創建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學四六

運動步數有氧達人2018-06-03

記錄運動步數,積累氧氣值。還可偷

每日養生app2018-06-03

每日養生,天天健康

體育訓練成績評定2018-06-03

通用課目體育訓練成績評定