Docker中運行多個Centos

 搜索Centos鏡像

docker search centos

NAME                               DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
centos                             The official build of CentOS.                   5978                [OK]                
ansible/centos7-ansible            Ansible on Centos7                              128                                     [OK]
jdeathe/centos-ssh                 OpenSSH / Supervisor / EPEL/IUS/SCL Repos - …   114                                     [OK]
consol/centos-xfce-vnc             Centos container with "headless" VNC session…   114                                     [OK]
centos/mysql-57-centos7            MySQL 5.7 SQL database server                   75                                      
imagine10255/centos6-lnmp-php56    centos6-lnmp-php56                              58                                      [OK]
tutum/centos                       Simple CentOS docker image with SSH access      46                                      
centos/postgresql-96-centos7       PostgreSQL is an advanced Object-Relational …   43                                      
kinogmt/centos-ssh                 CentOS with SSH                                 29                                      [OK]
pivotaldata/centos-gpdb-dev        CentOS image for GPDB development. Tag names…   11                                      
guyton/centos6                     From official centos6 container with full up…   10                                      [OK]
centos/tools                       Docker image that has systems administration…   6                                       [OK]
drecom/centos-ruby                 centos ruby                                     6                                       [OK]
pivotaldata/centos                 Base centos, freshened up a little with a Do…   4                                       
darksheer/centos                   Base Centos Image -- Updated hourly             3                                       [OK]
pivotaldata/centos-mingw           Using the mingw toolchain to cross-compile t…   3                                       
mamohr/centos-java                 Oracle Java 8 Docker image based on Centos 7    3                                       [OK]
pivotaldata/centos-gcc-toolchain   CentOS with a toolchain, but unaffiliated wi…   3                                       
miko2u/centos6                     CentOS6 日本語環境                                   2                                       [OK]
mcnaughton/centos-base             centos base image                               1                                       [OK]
blacklabelops/centos               CentOS Base Image! Built and Updates Daily!     1                                       [OK]
indigo/centos-maven                Vanilla CentOS 7 with Oracle Java Developmen…   1                                       [OK]
pivotaldata/centos7-dev            CentosOS 7 image for GPDB development           0                                       
pivotaldata/centos6.8-dev          CentosOS 6.8 image for GPDB development         0                                       
smartentry/centos                  centos with smartentry                          0                                       [OK]

拉取鏡像並指定版本7 

docker pull centos:7

 7: Pulling from library/centos
ab5ef0e58194: Pull complete 
Digest: sha256:4a701376d03f6b39b8c2a8f4a8e499441b0d567f9ab9d58e4991de4472fb813c
Status: Downloaded newer image for centos:7

查看本地所有鏡像 

docker images

 REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
centos                    latest              470671670cac        3 months ago        237MB
centos                    7                   5e35e350aded        5 months ago        203MB
centos/mysql-57-centos7   latest              f83a2938370c        6 months ago        452MB

 啓動Centos

docker run -itd --name centos1 5e35e350aded /bin/sh
docker run -itd --name centos2 5e35e350aded /bin/sh
docker run -itd --name centos3 5e35e350aded /bin/sh

查看當前啓動的容器 

docker ps

CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS              PORTS                    NAMES
b009ec2257b5        5e35e350aded              "/bin/sh"                3 seconds ago       Up 2 seconds                                 centos3
3ae7866e92a7        5e35e350aded              "/bin/sh"                16 seconds ago      Up 14 seconds                                centos2
37522c8c9a24        5e35e350aded              "/bin/sh"                15 minutes ago      Up 12 minutes                                centos1
20e26c85bd62        centos/mysql-57-centos7   "container-entrypoin…"   5 days ago          Up 27 minutes       0.0.0.0:3306->3306/tcp   mysql01

登陸到37522c8c9a24容器 

docker exec -it 37522c8c9a24 sh

查看當前版本 

sh-4.2# cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (Core)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章