1、在docker中查找centos

docker search centos

INDEX       NAME                                         DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/centos                             The official build of CentOS.                   5571      [OK]
docker.io   docker.io/ansible/centos7-ansible            Ansible on Centos7                              123                  [OK]
docker.io   docker.io/jdeathe/centos-ssh                 OpenSSH / Supervisor / EPEL/IUS/SCL Repos ...   112                  [OK]
docker.io   docker.io/consol/centos-xfce-vnc             Centos container with "headless" VNC sessi...   99                   [OK]
docker.io   docker.io/centos/mysql-57-centos7            MySQL 5.7 SQL database server                   63
docker.io   docker.io/imagine10255/centos6-lnmp-php56    centos6-lnmp-php56                              57                   [OK]
docker.io   docker.io/tutum/centos                       Simple CentOS docker image with SSH access      45
docker.io   docker.io/centos/postgresql-96-centos7       PostgreSQL is an advanced Object-Relationa...   39
docker.io   docker.io/kinogmt/centos-ssh                 CentOS with SSH                                 29                   [OK]
docker.io   docker.io/pivotaldata/centos-gpdb-dev        CentOS image for GPDB development. Tag nam...   10
docker.io   docker.io/guyton/centos6                     From official centos6 container with full ...   9                    [OK]
docker.io   docker.io/nathonfowlie/centos-jre            Latest CentOS image with the JRE pre-insta...   8                    [OK]
docker.io   docker.io/drecom/centos-ruby                 centos ruby                                     6                    [OK]
docker.io   docker.io/darksheer/centos                   Base Centos Image -- Updated hourly             3                    [OK]
docker.io   docker.io/mamohr/centos-java                 Oracle Java 8 Docker image based on Centos 7    3                    [OK]
docker.io   docker.io/pivotaldata/centos                 Base centos, freshened up a little with a ...   3
docker.io   docker.io/miko2u/centos6                     CentOS6 日本語環境                                   2                    [OK]
docker.io   docker.io/pivotaldata/centos-gcc-toolchain   CentOS with a toolchain, but unaffiliated ...   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/indigo/centos-maven                Vanilla CentOS 7 with Oracle Java Developm...   1                    [OK]
docker.io   docker.io/mcnaughton/centos-base             centos base image                               1                    [OK]
docker.io   docker.io/pivotaldata/centos6.8-dev          CentosOS 6.8 image for GPDB development         0
docker.io   docker.io/pivotaldata/centos7-dev            CentosOS 7 image for GPDB development           0
docker.io   docker.io/smartentry/centos                  centos with smartentry                          0                    [OK]

2、拉取centos镜像:

docker pull centos
[root@VM_0_12_centos ~]# docker pull centos
Using default tag: latest
Trying to pull repository docker.io/library/centos ...
latest: Pulling from docker.io/library/centos
d8d02d457314: Pull complete
Digest: sha256:307835c385f656ec2e2fec602cf093224173c51119bbebd602c53c3653a3d6eb
Status: Downloaded newer image for docker.io/centos:latest

查看镜像:

[root@VM_0_12_centos ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker.io/centos    latest              67fa590cfc1c        4 weeks ago         202 MB
docker.io/java      latest              d23bdf5b1b1b        2 years ago         643 MB

3、创建docker容器:

docker run -i -t -d -p 20:20 -p 21:21 -p 80:80 -p 443:443 -p 888:888 -p 8888:8888 --privileged=true -v /root/www:/www centos

备注:命令的意思是创建一个docker容器,并在后台运行,

-p:端口映射,将真机的20、21、80、443、888、88885个端口映射到docker容器中去

进入容器后重启宝塔服务

/etc/init.d/bt restart

/etc/init.d/bt restart

卸载宝塔面板

1、/etc/init.d/bt stop && rm -f /etc/init.d/bt && rm -rf /www/server/panel