docker 镜像管理

docker:/root# docker search centos
NAME                            DESCRIPTION                                     STARS     OFFICIAL   

AUTOMATED
centos                          The official build of CentOS.                   2028      [OK]       
jdeathe/centos-ssh              CentOS-6 6.7 x86_64 / CentOS-7 7.2.1511 x8...   17                   [OK]
jdeathe/centos-ssh-apache-php   CentOS-6 6.7 x86_64 / Apache / PHP / PHP M...   14                   [OK]
million12/centos-supervisor     Base CentOS-7 with supervisord launcher, h...   9                    [OK]
blalor/centos                   Bare-bones base CentOS 6.5 image                8                    [OK]
nimmis/java-centos              This is docker images of CentOS 7 with dif...   7                    [OK]
torusware/speedus-centos        Always updated official CentOS docker imag...   7                    [OK]
nickistre/centos-lamp           LAMP on centos setup                            3                    [OK]
nathonfowlie/centos-jre         Latest CentOS image with the JRE pre-insta...   3                    [OK]
centos/mariadb55-centos7                                                        3                    [OK]
consol/sakuli-centos-xfce       Sakuli end-2-end testing and monitoring co...   2                    [OK]
softvisio/centos                Centos                                          1                    [OK]
layerworx/centos                CentOS container with etcd, etcdctl, confd...   1                    [OK]
yajo/centos-epel                CentOS with EPEL and fully updated              1                    [OK]
timhughes/centos                Centos with systemd installed and running       1                    [OK]
pacur/centos-7                  Pacur CentOS 7                                  1                    [OK]
pacur/centos-6                  Pacur CentOS 6                                  1                    [OK]
darksheer/centos                Base Centos Image -- Updated hourly             1                    [OK]
lighthopper/orientdb-centos     A Dockerfile for creating an OrientDB imag...   1                    [OK]
ustclug/centos                   USTC centos                                    0                    [OK]
blacklabelops/centos            CentOS Base Image! Built and Updates Daily!     0                    [OK]
jsmigel/centos-epel             Docker base image of CentOS w/ EPEL installed   0                    [OK]
grayzone/centos                 auto build for centos.                          0                    [OK]
lighthopper/openjdk-centos      A Dockerfile for creating an OpenJDK image...   0                    [OK]
januswel/centos                 yum update-ed CentOS image                      0                    [OK]





启动镜像:

docker run -it centos /bin/bash


-i 表示让容器的标准输入打开,


-t 表示分配一个伪终端:


/bin/bash 容器里面允许的/bin/bash


docker pull centos:6.5  获取容器:



docker:/root# docker pull --help

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

Pull an image or a repository from the registry

拉取一个镜像或者一个存储库 从注册处


查看镜像:

docker:/root# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
januswel/centos     latest              088820de4929        12 days ago         198.3 MB


前台运行docker:



docker:/root# docker run -it januswel/centos  /bin/bash
[root@13fe7a3f05cc /]# 



查看正在运行的容器:

docker:/root# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS  

             NAMES
13fe7a3f05cc        januswel/centos     "/bin/bash"         About a minute ago   Up About a minute          

             boring_torvalds   

已经停掉的容器:

docker:/root# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS   

            NAMES
13fe7a3f05cc        januswel/centos     "/bin/bash"         2 minutes ago       Up 2 minutes                

            boring_torvalds   






创建 复制一个镜像:

docker:/root# docker tag januswel/centos  jj123

docker:/root# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
januswel/centos     latest              088820de4929        12 days ago         198.3 MB
jj123               latest              088820de4929        12 days ago         198.3 MB






docker 删除镜像:


docker rmi  jj123:latest 

docker rmi REPOSITORY:TAG

docker:/root# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
januswel/centos     latest              088820de4929        12 days ago         198.3 MB
jj123               latest              088820de4929        12 days ago         198.3 MB


docker:/root# docker rmi  jj123:latest 
Untagged: jj123:latest

docker:/root# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
januswel/centos     latest              088820de4929        12 days ago         198.3 MB



修改tag:

docker:/root# docker tag januswel/centos  linux123
docker:/root# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
januswel/centos     latest              088820de4929        12 days ago         198.3 MB
linux123            latest              088820de4929        12 days ago         198.3 MB



docker:/root# docker tag januswel/centos  linux123:jj
docker:/root# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
januswel/centos     latest              088820de4929        12 days ago         198.3 MB
linux123            latest              088820de4929        12 days ago         198.3 MB
linux123            jj                  088820de4929        12 days ago         198.3 MB













评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

scan724

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值