腾讯云-(8)-宝塔面板-安装Docker

如何使用 DeepSeek 帮助自己的工作? 10w+人浏览 518人参与

1. 左侧菜单栏,选择 Docker
2. 立即安装
3. 编译方式,默认即可
4. 出现successful!,代表成功
在这里插入图片描述
在这里插入图片描述

https://cmcc1-node.bt.cn

cat: /etc/redhat-release: No such file or directory
cat: /etc/redhat-release: No such file or directory
BaseOS 9 - x86_64 47 kB/s | 3.8 kB 00:00
BaseOS 9 - x86_64 4.1 MB/s | 1.3 MB 00:00
AppStream 9 - x86_64 65 kB/s | 3.8 kB 00:00
AppStream 9 - x86_64 24 MB/s | 13 MB 00:00
extras 9 - x86_64 39 kB/s | 3.0 kB 00:00
extras 9 - x86_64 5.3 kB/s | 884 B 00:00
Extra Packages for OpenCloudOS 9 - EPOL 18 kB/s | 3.0 kB 00:00
Extra Packages for OpenCloudOS 9 - EPOL 32 MB/s | 20 MB 00:00
No match for argument: yum-utils
Error: Unable to find a match: yum-utils
Adding repo from: file:///www/server/panel/mirrors.tencent.com/docker-ce/linux/centos/docker-ce.repo
Curl error (37): Couldn't read a file:// file for file:///www/server/panel/mirrors.tencent.com/docker-ce/linux/centos/docker-ce.repo [Couldn't open file /www/server/panel/mirrors.tencent.com/docker-ce/linux/centos/docker-ce.repo]
Error: Configuration of repo failed
BaseOS 9 - x86_64 58 kB/s | 3.8 kB 00:00
AppStream 9 - x86_64 49 kB/s | 3.8 kB 00:00
AppStream 9 - x86_64 24 MB/s | 13 MB 00:00
extras 9 - x86_64 43 kB/s | 3.0 kB 00:00
Extra Packages for OpenCloudOS 9 - EPOL 80 kB/s | 3.0 kB 00:00
Metadata cache created.
Last metadata expiration check: 0:00:01 ago on Sun 23 Nov 2025 08:14:54 PM CST.
Package lvm2-2.03.21-7.oc9.x86_64 is already installed.
Package device-mapper-persistent-data-1.0.4-8.oc9.x86_64 is already installed.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
docker-ce x86_64 28.0.1-2.oc9 EPOL 29 M
Installing dependencies:
container-selinux noarch 2.234.2-1.oc9 AppStream 49 k
containerd x86_64 1.7.27-1.oc9 AppStream 47 M
docker-ce-cli x86_64 28.0.1-3.oc9 EPOL 8.3 M
fuse-overlayfs x86_64 1.12-5.oc9 AppStream 64 k
fuse3 x86_64 3.16.2-3.oc9 AppStream 55 k
fuse3-libs x86_64 3.16.2-3.oc9 AppStream 91 k
libslirp x86_64 4.7.0-7.oc9 AppStream 72 k
runc x86_64 1.1.14-3.oc9 AppStream 3.5 M
slirp4netns x86_64 1.2.0-6.oc9 AppStream 44 k
Installing weak dependencies:
docker-buildx-plugin x86_64 0.19.3-3.oc9 EPOL 14 M
docker-ce-rootless-extras x86_64 28.0.1-1.oc9 EPOL 3.1 M
docker-compose-plugin x86_64 2.32.1-2.oc9 EPOL 14 M

Transaction Summary
================================================================================
Install 13 Packages

Total download size: 119 M
Installed size: 463 M
Downloading Packages:
(1/13): container-selinux-2.234.2-1.oc9.noarch. 430 kB/s | 49 kB 00:00
(2/13): fuse-overlayfs-1.12-5.oc9.x86_64.rpm 518 kB/s | 64 kB 00:00
(3/13): fuse3-3.16.2-3.oc9.x86_64.rpm 468 kB/s | 55 kB 00:00
(4/13): fuse3-libs-3.16.2-3.oc9.x86_64.rpm 685 kB/s | 91 kB 00:00
(5/13): libslirp-4.7.0-7.oc9.x86_64.rpm 650 kB/s | 72 kB 00:00
(6/13): slirp4netns-1.2.0-6.oc9.x86_64.rpm 374 kB/s | 44 kB 00:00
(7/13): containerd-1.7.27-1.oc9.x86_64.rpm 62 MB/s | 47 MB 00:00
(8/13): runc-1.1.14-3.oc9.x86_64.rpm 6.6 MB/s | 3.5 MB 00:00
(9/13): docker-buildx-plugin-0.19.3-3.oc9.x86_6 28 MB/s | 14 MB 00:00
(10/13): docker-ce-cli-28.0.1-3.oc9.x86_64.rpm 25 MB/s | 8.3 MB 00:00
(11/13): docker-ce-rootless-extras-28.0.1-1.oc9 18 MB/s | 3.1 MB 00:00
(12/13): docker-ce-28.0.1-2.oc9.x86_64.rpm 48 MB/s | 29 MB 00:00
(13/13): docker-compose-plugin-2.32.1-2.oc9.x86 32 MB/s | 14 MB 00:00
--------------------------------------------------------------------------------
Total 76 MB/s | 119 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : docker-compose-plugin-2.32.1-2.oc9.x86_64 1/13
Running scriptlet: docker-compose-plugin-2.32.1-2.oc9.x86_64 1/13
Installing : fuse3-libs-3.16.2-3.oc9.x86_64 2/13
Running scriptlet: fuse3-libs-3.16.2-3.oc9.x86_64 2/13
Installing : fuse3-3.16.2-3.oc9.x86_64 3/13
Installing : fuse-overlayfs-1.12-5.oc9.x86_64 4/13
Running scriptlet: fuse-overlayfs-1.12-5.oc9.x86_64 4/13
Installing : docker-buildx-plugin-0.19.3-3.oc9.x86_64 5/13
Running scriptlet: docker-buildx-plugin-0.19.3-3.oc9.x86_64 5/13
Installing : docker-ce-cli-28.0.1-3.oc9.x86_64 6/13
Running scriptlet: docker-ce-cli-28.0.1-3.oc9.x86_64 6/13
Installing : runc-1.1.14-3.oc9.x86_64 7/13
Installing : containerd-1.7.27-1.oc9.x86_64 8/13
Running scriptlet: containerd-1.7.27-1.oc9.x86_64 8/13
Installing : libslirp-4.7.0-7.oc9.x86_64 9/13
Installing : slirp4netns-1.2.0-6.oc9.x86_64 10/13
Running scriptlet: container-selinux-2.234.2-1.oc9.noarch 11/13
Installing : container-selinux-2.234.2-1.oc9.noarch 11/13
Running scriptlet: container-selinux-2.234.2-1.oc9.noarch 11/13
Installing : docker-ce-rootless-extras-28.0.1-1.oc9.x86_64 12/13
Running scriptlet: docker-ce-rootless-extras-28.0.1-1.oc9.x86_64 12/13
Installing : docker-ce-28.0.1-2.oc9.x86_64 13/13
Running scriptlet: docker-ce-28.0.1-2.oc9.x86_64 13/13
Running scriptlet: container-selinux-2.234.2-1.oc9.noarch 13/13
Running scriptlet: docker-ce-28.0.1-2.oc9.x86_64 13/13
Verifying : container-selinux-2.234.2-1.oc9.noarch 1/13
Verifying : containerd-1.7.27-1.oc9.x86_64 2/13
Verifying : fuse-overlayfs-1.12-5.oc9.x86_64 3/13
Verifying : fuse3-3.16.2-3.oc9.x86_64 4/13
Verifying : fuse3-libs-3.16.2-3.oc9.x86_64 5/13
Verifying : libslirp-4.7.0-7.oc9.x86_64 6/13
Verifying : runc-1.1.14-3.oc9.x86_64 7/13
Verifying : slirp4netns-1.2.0-6.oc9.x86_64 8/13
Verifying : docker-buildx-plugin-0.19.3-3.oc9.x86_64 9/13
Verifying : docker-ce-28.0.1-2.oc9.x86_64 10/13
Verifying : docker-ce-cli-28.0.1-3.oc9.x86_64 11/13
Verifying : docker-ce-rootless-extras-28.0.1-1.oc9.x86_64 12/13
Verifying : docker-compose-plugin-2.32.1-2.oc9.x86_64 13/13

Installed:
container-selinux-2.234.2-1.oc9.noarch
containerd-1.7.27-1.oc9.x86_64
docker-buildx-plugin-0.19.3-3.oc9.x86_64
docker-ce-28.0.1-2.oc9.x86_64
docker-ce-cli-28.0.1-3.oc9.x86_64
docker-ce-rootless-extras-28.0.1-1.oc9.x86_64
docker-compose-plugin-2.32.1-2.oc9.x86_64
fuse-overlayfs-1.12-5.oc9.x86_64
fuse3-3.16.2-3.oc9.x86_64
fuse3-libs-3.16.2-3.oc9.x86_64
libslirp-4.7.0-7.oc9.x86_64
runc-1.1.14-3.oc9.x86_64
slirp4netns-1.2.0-6.oc9.x86_64

Complete!
Error: Unable to find a match: atomic-registries container-storage-setup
Error: Unable to find a match: oci-register-machine oci-systemd-hook oci-umount python-pytoml subscription-manager-rhsm-certificates
Looking in indexes: https://mirrors.tencent.com/pypi/simple
Requirement already satisfied: pytz in ./pyenv/lib/python3.7/site-packages (2024.1)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Looking in indexes: https://mirrors.tencent.com/pypi/simple
Requirement already satisfied: docker in ./pyenv/lib/python3.7/site-packages (6.1.3)
Requirement already satisfied: packaging>=14.0 in ./pyenv/lib/python3.7/site-packages (from docker) (24.0)
Requirement already satisfied: requests>=2.26.0 in ./pyenv/lib/python3.7/site-packages (from docker) (2.27.1)
Collecting urllib3>=1.26.0 (from docker)
Downloading https://mirrors.tencent.com/pypi/packages/d2/b2/b157855192a68541a91ba7b2bbcb91f1b4faa51f8bae38d8005c034be524/urllib3-2.0.7-py3-none-any.whl (124 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 124.2/124.2 kB 811.7 kB/s eta 0:00:00
Requirement already satisfied: websocket-client>=0.32.0 in ./pyenv/lib/python3.7/site-packages (from docker) (1.6.1)
Downloading https://mirrors.tencent.com/pypi/packages/33/cf/8435d5a7159e2a9c83a95896ed596f68cf798005fe107cc655b5c5c14704/urllib3-1.26.20-py2.py3-none-any.whl (144 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 144.2/144.2 kB 8.5 MB/s eta 0:00:00
Requirement already satisfied: certifi>=2017.4.17 in ./pyenv/lib/python3.7/site-packages (from requests>=2.26.0->docker) (2024.2.2)
Requirement already satisfied: charset-normalizer~=2.0.0 in ./pyenv/lib/python3.7/site-packages (from requests>=2.26.0->docker) (2.0.12)
Requirement already satisfied: idna<4,>=2.5 in ./pyenv/lib/python3.7/site-packages (from requests>=2.26.0->docker) (3.7)
Installing collected packages: urllib3
Attempting uninstall: urllib3
Found existing installation: urllib3 1.25.11
Uninstalling urllib3-1.25.11:
Successfully uninstalled urllib3-1.25.11
Successfully installed urllib3-1.26.20
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
/bin/systemctl
Created symlink /etc/systemd/system/getty@tty1.service → /dev/null.
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
===============================================
successful!
<think>嗯,用户这次的问题非常具体,明确指向在腾讯云宝塔面板环境下配置Playwright的需求。结合对话历史,用户之前可能已经尝试过基础安装但遇到困难,现在需要针对宝塔环境的专项指导。值得注意,用户引用了两篇关于云服务安装Playwright的踩坑文章,说明ta很可能正在遭遇类似问题——特别是境内云服务器常见的网络限制和环境隔离问题。用户的核心诉求其实可以拆解成三个层次:首先是Playwright的基础安装,其次是宝塔面板的集成适配,最后是可能出现的境内服务器特有问题的解决方案。有趣的是,用户特别提到“腾讯云”,这暗示我们需要考虑境内云服务的特殊性,比如默认防火墙规则、yum/apt源速度慢、缺失依赖库等问题。从技术角度看,这个需求存在几个关键挑战点:宝塔的Python环境管理方式与系统环境可能存在冲突,境内服务器安装Playwright依赖的浏览器二进制文件会遇到下载障碍,以及非root用户下调用硬件加速的限制。用户没有说明具体使用场景,但既然提到“操作”,很可能涉及自动化截图或爬虫,所以需要重点说明无头模式配置。在方案设计上,应该优先考虑最小化权限原则,避免让用户使用root权限操作。参考引用[1]提到的AsyncChromiumLoader,说明用户可能需要涉及Playwright的异步调用场景。引用[2]中提到的Docker避坑方案虽然诱人,但考虑到用户明确要在宝塔原生环境使用,需要另辟蹊径。特别要注意的是,用户之前得到的示例是快速排序算法回复,当前问题却突然转向运维部署,这种跳跃可能意味着用户是个全栈开发者,正同时处理前后端任务。因此回答中需要避免假定用户的系统管理经验水平,对关键命令如NODE_OPTIONS的解释要足够直白。</think> 在腾讯云服务器通过宝塔面板配置 Playwright 需解决环境依赖和权限问题,以下是详细步骤和避坑指南: --- ### **核心步骤** #### 1. **前置环境准备** ```bash # 安装系统依赖(CentOS 示例) sudo yum install -y epel-release sudo yum install -y libX11 libXcomposite libXcursor libXdamage libXext libXi libXtst cups-libs libXScrnSaver libXrandr alsa-lib pango atk at-spi2-atk gtk3 # 安装 Python 环境(推荐 Python ≥3.8) sudo bt 1 # 在宝塔面板 "软件商店" → "Python项目管理器" 安装 Python 3.8+ ``` #### 2. **安装 Playwright** ```bash # 在项目虚拟环境中执行(如使用宝塔Python项目管理器) source /www/server/panel/virtualenvs/your_project/bin/activate pip install playwright --upgrade # 安装浏览器二进制文件(关键步骤!) playwright install chromium # 跳过此步会导致无法调用浏览器 ``` **避坑点**: - 境内服务器可能因网络问题无法下载 Chromium: ```bash # 手动指定镜像源安装(如失败则需离线下载) PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright playwright install chromium ``` - 如超时,需手动下载二进制包: 1. 从 [Playwright Releases](https://github.com/microsoft/playwright/releases) 下载 `chromium-xxx-linux.zip` 2. 解压到 `~/.cache/ms-playwright/chromium-xxx` 目录 #### 3. **宝面板配置** - **修改 Nginx 代理配置**(如通过 Web 服务调用) ```nginx location /your_api { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } ``` - **设置任务计划**(定时脚本场景): 在宝塔 "计划任务" → 添加 Shell 脚本: ```bash cd /www/wwwroot/your_project && /www/server/panel/virtualenvs/your_project/bin/python /script_path/your_playwright_script.py ``` #### 4. **测试脚本** 创建测试文件 `test_playwright.py`: ```python from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.chromium.launch(headless=True) # 无头模式 page = browser.new_page() page.goto("https://example.com") print(page.title()) page.screenshot(path="screenshot.png") browser.close() ``` 运行验证: ```bash source /www/server/panel/virtualenvs/your_project/bin/activate python test_playwright.py ``` --- ### **权限避坑指南** | 问题现象 | 解决方案 | |--------------------------|------------------------------| | `Failed to launch browser` | 执行 `chown -R www:www ~/.cache/ms-playwright`(将缓存目录权限赋予 Web 用户) | | 截图/下载失败 | 指定绝对路径如 `/tmp/screenshot.png` | | GPU 加速异常 | 启动参数添加 `chromium.launch(args=["--disable-gpu"])` | --- ### **调试技巧** 1. 开启非无头模式调试: ```python browser = p.chromium.launch(headless=False) # 需安装 Xvfb ``` 2. 安装 Xvfb(无图形界面支持): ```bash sudo yum install -y Xvfb Xvfb :99 -ac & export DISPLAY=:99 ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值