下载个单独的系统镜像
[root@git opt]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/nginx-tomcat latest 484c03c00ff8 3 days ago 461 MB docker/nginx latest 8408aabf1fb6 3 days ago 302 MB docker.io/tomcat8 latest 37e6b19c14e0 5 days ago 517 MB docker.io/jumpserver/jumpserver latest 055f42f305f5 5 days ago 1.41 GB gitalb-zh latest dd61a1ec3cdc 6 days ago 1.72 GB docker.io/twang2218/gitlab-ce-zh latest 1f71f185271a 2 weeks ago 1.63 GB docker.io/centos latest 2d194b392dd1 2 weeks ago 195 MB
启动容器之端口开放
[root@git opt]# docker run -itd -p 20:20 -p 21:21 -p 80:80 -p 443:443 -p 888:888 -p 8888:8888 -v /root/www:/www docker.io/centos a91f0fad2021b178e1bf32341933735e78bfffd754a1277454863479ca065b38 [root@git opt]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a91f0fad2021 docker.io/centos "/bin/bash" 3 seconds ago Up 2 seconds 0.0.0.0:20-21->20-21/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:888->888/tcp, 0.0.0.0:8888->8888/tcp distracted_snyder
docker exec -it a91f0fad2021 bash 进入容器 yum update -y && yum install initscripts screen wget -y 安装必要的软件 screen -S install_bt 为了保证我在安装过程中不至于要长期连接服务器,所以我使用了screen 安装宝塔面板 wget -O install.sh http://download.bt.cn/install/install.sh && sh install.sh