RHEL 7 安装使用docker

一、简介

Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。

二、安装

Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。

通过 uname -r 命令查看你当前的内核版本

[root@localhost ~]# uname -r
3.10.0-693.el7.x86_64

yum update -y

yum -y install docker

docker安装成功后

启动docker服务:systemctl start docker

查看是否启动成功:systemctl status docker

三、pull镜像

1、docker search centos #搜索名字为centos的镜像、

[root@localhost ~]# docker search centos
INDEX       NAME                                         DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/centos                             The official build of CentOS.                   4756      [OK]       
docker.io   docker.io/ansible/centos7-ansible            Ansible on Centos7                              118                  [OK]
docker.io   docker.io/jdeathe/centos-ssh                 CentOS-6 6.10 x86_64 / CentOS-7 7.5.1804 x...   99                   [OK]
docker.io   docker.io/consol/centos-xfce-vnc             Centos container with "headless" VNC sessi...   63                   [OK]
docker.io   docker.io/imagine10255/centos6-lnmp-php56    centos6-lnmp-php56                              45                   [OK]
docker.io   docker.io/tutum/centos                       Simple CentOS docker image with SSH access      43                   
docker.io   docker.io/centos/mysql-57-centos7            MySQL 5.7 SQL database server                   39                   
docker.io   docker.io/gluster/gluster-centos             Official GlusterFS Image [ CentOS-7 +  Glu...   34                   [OK]
docker.io   docker.io/openshift/base-centos7             A Centos7 derived base image for Source-To...   33                   
docker.io   docker.io/centos/python-35-centos7           Platform for building and running Python 3...   31                   
docker.io   docker.io/centos/postgresql-96-centos7       PostgreSQL is an advanced Object-Relationa...   29                   
docker.io   docker.io/kinogmt/centos-ssh                 CentOS with SSH                                 22                   [OK]
docker.io   docker.io/openshift/jenkins-2-centos7        A Centos7 based Jenkins v2.x image for use...   15                   
docker.io   docker.io/pivotaldata/centos-gpdb-dev        CentOS image for GPDB development. Tag nam...   7                    
docker.io   docker.io/openshift/wildfly-101-centos7      A Centos7 based WildFly v10.1 image for us...   5                    
docker.io   docker.io/openshift/jenkins-1-centos7        DEPRECATED: A Centos7 based Jenkins v1.x i...   4                    
docker.io   docker.io/darksheer/centos                   Base Centos Image -- Updated hourly             3                    [OK]
docker.io   docker.io/pivotaldata/centos                 Base centos, freshened up a little with a ...   2                    
docker.io   docker.io/pivotaldata/centos-mingw           Using the mingw toolchain to cross-compile...   2                    
docker.io   docker.io/blacklabelops/centos               CentOS Base Image! Built and Updates Daily!     1                    [OK]
docker.io   docker.io/jameseckersall/sonarr-centos       Sonarr on CentOS 7                              0                    [OK]

2、docker pull docker.io/centos #使用pull下载镜像,第一个是官方的镜像

3、docker run docker.io/centos echo "hello docker" #测试

 

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐