docker 安装宝塔面板

准备工作

安装docker阿里云yum源

wget -P /etc/yum.repos.d/ https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]# ls
bak  Centos-7.repo  docker-ce.repo

列出可以安装的docker版本

yum list docker-ce --showduplicates | sort -r

检查系统版本

cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

检查内核版本

 uname  -a 
Linux localhost.localdomain 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

开始实验

本次使用yum指定安装docker版本

 yum install docker-ce-20.10.21-3.el7 -y 
 systemctl start docker
 systemctl  enable  docker 
 ps -ef | grep docker

docker版本检查

docker --version   # 这个是精简版
docker  version  详细版本内容介绍
[root@localhost ~]# docker --version 
Docker version 23.0.1, build a5ee5b1
[root@localhost ~]# docker version 
Client: Docker Engine - Community
 Version:           23.0.1
 API version:       1.41 (downgraded from 1.42)
 Go version:        go1.19.5
 Git commit:        a5ee5b1
 Built:             Thu Feb  9 19:51:00 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       3056208
  Built:            Tue Oct 25 18:02:38 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.18
  GitCommit:        2456e983eb9e37e47538f59ea18f2043c9a73640
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

下载宝塔镜像

docker search   pch18/baota
NAME          DESCRIPTION                                    STARS     OFFICIAL   AUTOMATED
pch18/baota   宝塔面板docker部署 支持安装后在线升级到最新…   264                  [OK]
[root@localhost ~]# docker pull pch18/baota
Using default tag: latest
latest: Pulling from pch18/baota
75f829a71a1c: Pull complete 
5e0c046a5b8e: Pull complete 
38bed6e199a3: Pull complete 
49dbb641daad: Pull complete 
f8da28de96af: Pull complete 
90d1dd96920c: Pull complete 
50d067f99e66: Pull complete 
7c656c43c49b: Pull complete 
97ac234ad54b: Pull complete 
cb307f0f8285: Pull complete 
Digest: sha256:0c16be7fe150eff9b2bc94e536ab0221f3ca4a4c534d7ca62daa73bb3c418fc2
Status: Downloaded newer image for pch18/baota:latest
docker.io/pch18/baota:latest
[root@localhost ~]# docker images pch18/baota
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
pch18/baota   latest    621e17613692   2 years ago   5.46GB

##开始部署

创建挂载目录

mkdir -p /data/baota
cd /data/baota

运行宝塔镜像

docker run -tid --name baota -p 8526:80 -p 493:443 -p 8888:8888 -p 888:888 --privileged=true --shm-size=1g --restart always -v /data/baota/:/www/wwwroot pch18/baota

[root@localhost ~]# docker run -tid --name baota -p 8526:80 -p 493:443 -p 8888:8888 -p 888:888 --privileged=true --shm-size=1g --restart always -v /data/baota/:/www/wwwroot pch18/baota
/ne5acc937c614ff2e06faa095b5f64aa8114a9810e8a19c9cb1698fae2e9810da
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e5acc937c614 pch18/baota “/bin/sh -c /entrypo…” About a minute ago Up About a minute (healthy) 0.0.0.0:888->888/tcp, :::888->888/tcp, 20-21/tcp, 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp, 0.0.0.0:8526->80/tcp, :::8526->80/tcp, 0.0.0.0:493->443/tcp, :::493->443/tcp baota

访问宝塔面板

docker 安装宝塔面板_第1张图片

修改密码

1、进入容器

docker exec -it baota /bin/bash
cd /www/server/panel
输入命令: bt

第一次进入宝塔面板,需要使用默认用户和命名,接着需要自己注册账号和密码
docker 安装宝塔面板_第2张图片

你可能感兴趣的:(云原生,docker)