Docker Standalone 单体
Introduction 引言
Portainer consists of two elements, the Portainer Server, and the Portainer Agent. Both elements run as lightweight Docker containers on a Docker engine. This document will help you install the Portainer Server container on your Linux environment. To add a new Linux environment to an existing Portainer Server installation, please refer to the Portainer Agent installation instructions.
Portainer 由两个元素组成: Portainer Server 和 Portainer Agent。这两个元素在 Docker 引擎上作为轻量级 Docker 容器运行。此文档将帮助您在 Linux 环境中安装 Portainer Server 容器。要向现有的 Portainer 服务器安装中添加新的 Linux 环境,请参阅 Portainer Agent 安装说明。
To get started, you will need:
开始的时候,你需要:
- The latest version of Docker installed and working最新版本的 Docker 安装和工作
- sudo access on the machine that will host your Portainer Server instance在将托管您的 Portainer 服务器实例的机器上进行 sudo 访问
- By default, Portainer Server will expose the UI over port 9443 and expose a TCP tunnel server over port 8000. The latter is optional and is only required if you plan to use the Edge compute features with Edge agents.默认情况下,Portainer Server 将通过端口9443公开 UI,并通过端口8000公开 TCP 隧道服务器。后者是可选的,只有在计划使用 Edge 代理程序计算边缘特性时才需要。
The installation instructions also make the following assumptions about your environment:
安装说明还对您的环境做了以下假设:
- Your environment meets our requirements. While Portainer may work with other configurations, it may require configuration changes or have limited functionality.您的环境符合我们的要求。虽然 Portainer 可能与其他配置一起工作,但它可能需要更改配置或具有有限的功能。
- You are accessing Docker via Unix sockets. Alternatively, you can also connect via TCP.你可以通过 Unix 套接字访问 Docker,或者,你也可以通过 TCP 连接。
- SELinux is disabled on the machine running Docker. If you require SELinux, you will need to pass the --privileged flag to Docker when deploying Portainer.在运行 Docker 的机器上禁用 SELinux。如果您需要 SELinux,那么在部署 Portainer 时需要将 – privileged 标志传递给 Docker。
- Docker is running as root. Portainer with rootless Docker has some limitations, and requires additional configuration.Docker 以 root 身份运行。带有无根 Docker 的 Portainer 有一些限制,并且需要额外的配置。
Deployment 部署
First, create the volume that Portainer Server will use to store its database:
首先,创建 Portainer Server 用来存储数据库的卷:
docker volume create portainer_data
Then, download and install the Portainer Server container:
然后,下载并安装 Portainer Server 容器:
docker run -d -p 8000:8000 -p 9443:9443 --name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:2.11.1
By default, Portainer generates and uses a self-signed SSL certificate to secure port 9443. Alternatively you can provide your own SSL certificate during installation or via the Portainer UI after installation is complete.
默认情况下,Portainer 生成并使用自签名的 SSL 证书来保护端口9443。或者,您可以在安装过程中提供自己的 SSL 证书,或者在安装完成后通过 Portainer UI 提供。
If you require HTTP port 9000 open for legacy reasons, add the following to your docker run command:
如果因为遗留的原因需要打开 HTTP 端口9000,在 docker run 命令中添加以下命令:
-p 9000:9000
docker run -d -p 8000:8000 -p 9443:9443 -p 9000:9000 --name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:2.11.1
Portainer Server has now been installed. You can check to see whether the Portainer Server container has started by running docker ps:
已经安装了 Portainer 服务器。你可以通过运行docker ps
来检查 Portainer Server 容器是否已经启动:
Logging In 登录
Now that the installation is complete, you can log into your Portainer Server instance by opening a web browser and going to:
现在安装已经完成,你可以通过打开浏览器登录到你的 Portainer Server 实例,然后:
https://localhost:9443
Replace localhost with the relevant IP address or FQDN if needed, and adjust the port if you changed it earlier.
如果需要,用相关的 IP 地址或 FQDN 替换本地主机,如果更早更改了端口,则调整端口。
You will be presented with the initial setup page for Portainer Server.
您将看到 Portainer Server 的初始设置页面。
Docker Swarm 集群
参考官方文档
Kubernetes
参考官方文档
参考文档
Set up a new Portainer Server installation - Portainer Documentation