-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
36 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,12 @@ | ||
# 创建关联容器 | ||
|
||
> 关联容器是指创建容器时需要依赖其它容器 | ||
关联容器是指创建容器时需要依赖其它容器 | ||
|
||
这里通过创建 mysql 和 phpmyadmin 演示如何创建容器关联 | ||
### 关联容器 | ||
|
||
### 配置 | ||
在创建容器时,在【关联配置】中的【关联容器】选择需要关联的外部容器。 | ||
|
||
#### Mysql | ||
### 容器内互联 | ||
|
||
创建时需要指定 MYSQL_ROOT_PASSWORD 环境变量,初始化数据库 root 密码,否则服务无法启动 | ||
关联容器后,可以配置目标容器的 hostname,也可以通过默认的 **容器标识.pod.dpanel.local** 进行互联 | ||
|
||
#### Phpmyadmin | ||
|
||
创建时需要关联对应的 Mysql 容器,系统将会给每一个容器分配一个内部 Host,容器之间可通过此 Host 进行互相访问 | ||
|
||
创建 Phpmyadmin 容器时,需要将 PMA_HOST 环境变量指定为 Mysql 的内部 Host | ||
|
||
### 网络 | ||
|
||
#### 默认网络 | ||
|
||
Docker 会给每一个容器创建一个默认的 bridge 网络。你也可以不关联容器,直接通过默认网络中配置的容器 Ip 进行互联。 | ||
|
||
但是并不推荐这样做,因为容器重启后,其 Ip 地址会发生变化。直接使用 Ip 可能会造成无法访问的问题。 | ||
|
||
#### 关联网络 | ||
|
||
DPanel 会将关联的容器放置到同一个网络中,将配置独立的 Host。 | ||
|
||
Host 命令规则为 **容器标识.pod.dpanel.local** | ||
|
||
|
||
# 演示 | ||
|
||
<iframe src="//player.bilibili.com/player.html?isOutside=true&aid=112488916716288&bvid=BV1nfu6eNEsi&cid=500001555764866&p=1" scrolling="no" border="0" height="600" frameborder="no" framespacing="0" allowfullscreen="true"></iframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
# 创建单容器 | ||
|
||
> 单容器是指不需要关联其它容器可独立运行的应用。 | ||
这里以 Minio 为例,演示如何通过镜像创建一个应用容器。 | ||
单容器是指不需要关联其它容器可独立运行的应用。 | ||
|
||
### 配置 | ||
|
||
创建 Minio 时候,暴露 9000 和 9001 端口,并配置启动 cmd 命令为 | ||
以创建 minio 容器为例 | ||
|
||
``` | ||
server /data --console-address :9001 | ||
``` | ||
| 配置组 | 配置项 | 值 | 描述 | | ||
| ------ | --- | --- | --- | | ||
| 基本配置 | 容器标识 | minio | 创建的容器的名称 | | ||
|基本配置| 镜像 | docker.1panel.live/minio/minio:latest | 使用【拉取镜像】按钮获取镜像 | | ||
|基本配置| 绑定端口 | 9000 | 映射9000端口,为空为随机生成 | | ||
|基本配置| 绑定端口 | 9001 | 映射9001端口,为空为随机生成 | | ||
| 存储配置| 自定义挂载或是存储卷 | miniodata 或是 /home/miniodata | 指定挂载 /data 目录或是存储卷,为空为生成存储卷 | | ||
| 运行配置 | Command | server /data --console-address :9001 | 配置启动参数 | | ||
|
||
### 访问 | ||
|
||
使用 http://127.0.0.1:9001 进行访问 | ||
|
||
默认用户为 minioadmin / minioadmin | ||
|
||
# 演示 | ||
|
||
<iframe src="//player.bilibili.com/player.html?isOutside=true&aid=112484158931712&bvid=BV1MfgcehEZy&cid=500001554797263&p=1" scrolling="no" border="0" height="600" frameborder="no" framespacing="0" allowfullscreen="true"></iframe> | ||
默认用户为 minioadmin / minioadmin |