sudo docker info 查看docker状态。

jiqing@ThinkPad:~$ sudo docker info
[sudo] password for jiqing:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 17.12.1-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 3
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
apparmor
Kernel Version: 4.4.0-121-generic
Operating System: Ubuntu 14.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.545GiB
Name: ThinkPad
ID: CDSQ:IGPU:FZGN:XIK7:4PSI:XBCV:MBTV:PDFG:BHHA:62Y3:V65H:RW6I
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

sudo docker search 从Docker Hub中搜索符合条件的镜像。

jiqing@ThinkPad:~$ sudo docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 4249 [OK]
ansible/centos7-ansible Ansible on Centos7 109 [OK]
jdeathe/centos-ssh CentOS-6 6.9 x86_64 / CentOS-7 7.4.1708 x86_… 94 [OK]
consol/centos-xfce-vnc Centos container with "headless" VNC session… 52 [OK]
imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 40 [OK]
tutum/centos Simple CentOS docker image with SSH access 39
gluster/gluster-centos Official GlusterFS Image [ CentOS-7 + Glust… 28 [OK]
centos/mysql-57-centos7 MySQL 5.7 SQL database server 27
openshift/base-centos7 A Centos7 derived base image for Source-To-I… 22
centos/python-35-centos7 Platform for building and running Python 3.5… 20
kinogmt/centos-ssh CentOS with SSH 19 [OK]
centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relational … 16
centos/httpd-24-centos7 Platform for running Apache httpd 2.4 or bui… 12
openshift/jenkins-2-centos7 A Centos7 based Jenkins v2.x image for use w… 12
openshift/mysql-55-centos7 DEPRECATED: A Centos7 based MySQL v5.5 image… 6
openshift/jenkins-1-centos7 DEPRECATED: A Centos7 based Jenkins v1.x ima… 4

从公网docker hub中拉取镜像。

jiqing@ThinkPad:~$ sudo docker pull imagine10255/centos6-lnmp-php56
Using default tag: latest
latest: Pulling from imagine10255/centos6-lnmp-php56
f402e43879a8: Pull complete
e76184b3b2ef: Pull complete
c92be21ea534: Pull complete
ae5dfaaf3d26: Pull complete
d1614380713d: Pull complete
1296ca419182: Pull complete
eb1025bb2c5f: Pull complete
d761ada82e04: Pull complete
bd37fe1cf1bc: Pull complete
720ddecae86e: Pull complete
3a5e00e20834: Pull complete
7333af8d24da: Pull complete
32350ff46b09: Pull complete
ebce168aa31f: Pull complete
07a958684e90: Pull complete
8d46caeb2844: Pull complete
e355ba831fdf: Pull complete
2fcf76f7d667: Pull complete
a3fd51a842a5: Pull complete
d261a5a31aa6: Pull complete
80bfae2d4c60: Pull complete
bff9ad54a247: Pull complete
be829cd95222: Pull complete
Digest: sha256:63b3192b5772e252adfd7860712dac16e96315fb16e582f7d17dff32b0c680f0
Status: Downloaded newer image for imagine10255/centos6-lnmp-php56:latest

sudo docker images查看镜像

jiqing@ThinkPad:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest e38bc07ac18e 3 weeks ago 1.85kB
imagine10255/centos6-lnmp-php56 latest ecc74d703eca 18 months ago 1.31GB

删除本地镜像

jiqing@ThinkPad:/var/lib/docker$ sudo docker rmi -f e38bc07ac18e
Untagged: hello-world:latest
Untagged: hello-world@sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
Deleted: sha256:e38bc07ac18ee64e6d59cf2eafcdddf9cec2364dfe129fe0af75f1b0194e0c96

启动一个镜像

jiqing@ThinkPad:/var/lib/docker$ sudo docker run -it imagine10255/centos6-lnmp-php56
Starting nginx: [ OK ]
Starting php-fpm: [ OK ]
Generating SSH2 RSA host key: [ OK ]
Generating SSH1 RSA host key: [ OK ]
Generating SSH2 DSA host key: [ OK ]
Starting sshd: [ OK ]
[root@518abb0ea706 /]# ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:AC:11:00:01
inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:58 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8100 (7.9 KiB) TX bytes:0 (0.0 b) lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

这是来自镜像的lnmp服务。

[root@8e44bd1abf81 home]# exit;
exit

docker镜像存储位置

jiqing@ThinkPad:/var/lib/docker$ sudo du -sh /var/lib/docker/*
1.4G /var/lib/docker/aufs
20K /var/lib/docker/builder
100K /var/lib/docker/containerd
44K /var/lib/docker/containers
4.0K /var/lib/docker/graph
3.1M /var/lib/docker/image
9.9M /var/lib/docker/init
8.0K /var/lib/docker/linkgraph.db
56K /var/lib/docker/network
20K /var/lib/docker/plugins
4.0K /var/lib/docker/repositories-aufs
4.0K /var/lib/docker/runtimes
4.0K /var/lib/docker/swarm
4.0K /var/lib/docker/tmp
4.0K /var/lib/docker/trust
28K /var/lib/docker/volumes

查看本地容器

jiqing@ThinkPad:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1949036422c3 imagine10255/centos6-lnmp-php56 "bash" 13 minutes ago Up 13 minutes 22/tcp, 80/tcp, 8080/tcp vigilant_bhaskara
518abb0ea706 imagine10255/centos6-lnmp-php56 "bash" 18 minutes ago Exited (0) 13 minutes ago elastic_raman

删除容器

jiqing@ThinkPad:~$ sudo docker rm -f 8dbc8af6e4ca
8dbc8af6e4ca

docker 基本指令的更多相关文章

  1. docker Dockerfile指令ADD和COPY的区别,添加目录方法

    docker Dockerfile指令ADD和COPY的区别,添加目录方法 ADD指令的功能是将主机构建环境(上下文)目录中的文件和目录.以及一个URL标记的文件 拷贝到镜像中.其格式是: ADD 源 ...

  2. Centos7 docker 常用指令

    Docker 运行在 CentOS 7 上,要求系统为64位.系统内核版本为 3.10 以上 一.docker的安装及卸载 1.查看当前系统内核版本: [root@docker ~]# uname - ...

  3. Docker Dockerfile指令

    Docker 可以通过 Dockerfile 的内容来自动构建镜像.Dockerfile 是一个包含创建镜像所有命令的文本文件,通过docker build命令可以根据 Dockerfile 的内容构 ...

  4. Docker 基本指令整理(一)

    安装Docker yum install docker 1   1 yum install docker 开机自启动 -- centos 6 service docker start chkconfi ...

  5. 阿里云部署Docker(3)----指令学习

    通过上两节的学习http://blog.csdn.net/minimicall/article/details/40119177 和http://blog.csdn.net/minimicall/ar ...

  6. Docker Dockerfile 指令详解与实战案例

    Dockerfile介绍及常用指令,包括FROM,RUN,还提及了 COPY,ADD,EXPOSE,WORKDIR等,其实 Dockerfile 功能很强大,它提供了十多个指令. Dockerfile ...

  7. centos 7 安装docker 常用指令

    什么是docker l  使用最广泛的开源容器引擎 l  一种操作系统级的虚拟化技术 l  依赖于Linux内核特性:Namespace和Cgroups l  一个简单的应用程序打包工具 docker ...

  8. Docker——run指令中-it与-d的关系

    建立相关的测试容器 #1.只有-d [root@iZwz908j8pbqd86doyrez5Z test]# docker run -d -p 8081:8080 tomcat:9.0 #2.只有-i ...

  9. docker常用指令01

    1.进入交互式界面 docker run (--name=xx命名)-i -t ubuntu /bin/bash docker run --name=con1 -i -t ubuntu /bin/ba ...

  10. docker 删除指令

    杀死所有正在运行的容器 docker kill $(docker ps -a -q) 删除所有已经停止的容器 docker rm $(docker ps -a -q) 删除所有未打 dangling ...

随机推荐

  1. Java中9大内置基本数据类型Class实例和数组的Class实例(转载)

    https://www.jianshu.com/p/58976c8bf1e1

  2. WC2007 石头剪刀布 数学+最小费用最大流

    题面: 有N个人参加一场比赛,赛程规定任意两个人之间都要进行一场比赛:这样总共有N*(N-1)/2场比赛.比赛已经进行了一部分,我们想知道在极端情况下,比赛结束后最多会发生多少剪刀石头布情况.即给出已 ...

  3. 零基础入门学习Python(31)--永久存储:腌制一缸美味的泡菜

    知识点 pickle( 泡菜 ) 模块介绍: pickle模块作用是持久化的储存数据. 在Python程序运行中得到了一些字符串.列表.字典等数据,想要长久的保存下来,方便以后使用, 而不是简单的放入 ...

  4. 零基础入门学习Python(15)--格式化

    前言 上节课我们介绍了字符串N多种奇葩方法的用法,但是我们唯独漏掉了format方法,那为何不把format方法和上节课的内容一起讲呢? 因为小甲鱼觉得format方法,跟今天的主题是如出一辙的,都是 ...

  5. 一次ORA-01555问题分析,及SQL优化。

    前言 客户说: 我在数据库上继续运行昨日的脚本,但发现有个子过程在运行10个小时后报错: 烦请协助看看... 错误码是:ORA-01555: snapshot too old: rollback se ...

  6. lucene-5.3.1配置(win7x64)

    lucene下载地址:http://www.us.apache.org/dist/lucene/java/5.3.1/lucene-5.3.1.zip 下载之后解压 控制台应用程序下配置: 找到luc ...

  7. 分数拆分(刘汝佳紫书P183)

    枚举,由已知条件推得y大于k,小于等于2K AC代码: #include"iostream"#include"cstring"using namespace s ...

  8. BNUOJ 1541 Air Raid

    Air Raid Time Limit: 1000ms Memory Limit: 10000KB This problem will be judged on PKU. Original ID: 1 ...

  9. HDU4463-Outlets,简单最小生成树。1A水过~~

    Outlets                                                                                             ...

  10. poj 3667 Hotel (线段树的合并操作)

    Hotel The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a ...