TDengine- 安装 -docker
TDengine- 安装 -docker
官方文档
容器地址:Docker-TDengine
最佳实践,
docker run -d --name tdengine --hostname=tdengine-server -v /data/taos/log:/var/log/taos -v /data/taos/data:/var/lib/taos -v /data/taos/taos.cfg:/etc/taos/taos.cfg -p 6030-6041:6030-6041 -p 6030-6041:6030-6041/udp tdengine/tdengine-aarch64:3.0.1.8
其中三个 -v 参数。是为了将容器的数据,日志还有配置与宿主机同步,这样,容器重启或者删除,数据和配置都不会消失。
- --name tdengine: set the container name, we can access the corresponding container by container name
- --hostnamename=tdengine-server: set the hostname of the Linux system inside the container, we can map the hostname and IP to solve the problem that the container IP may change.
- -v: Set the host file directory to be mapped to the inner container directory to avoid data loss after the container is deleted.
我们可以在容器启动之后通过docker exec进入容器
首先通过docker ps获取一个名称

然后再执行语句
docker exec -it tdengine /bin/bash
然后就可以像进入了一个虚拟机中一样进行查看和修改,不过重启容器之后,这些修改就会丢失,所以保险的方式还是通过 -v 实现与主机的同步
- docker exec: Enter the container by the
docker execcommand, if exited, the container will not stop. - -i: use interactive mode.
- -t: specify a terminal.
- tdengine: container name, needs to be changed according to the value returned by the docker ps command.
- /bin/bash: load the container and run bash to interact with it.
进入容器中之后,我们就可以进入 tdengine 数据库
taos
修改 docker 中的配置文件
参考博客:docker修改容器配置文件的三种方法 - 掘金
docker 常用命令
1.Docker常用命令 · Coder的自我修养 · 看云
如何通过 x86 环境下载 arm 镜像,
有的镜像会专门打一个 arm 版,例如 xxx-arm,有的则是集成在一个名字下面,比如这样

你如果在 x86 上 pull 这个镜像,再导出来,那在 arm 下是用不了的,你要在 pull 的时候指定文件签名,例如这个 tdengine 的 3.0.1.8 的 arm 版是
docker pull tdengine/tdengine:3.0.1.8@sha256:4a4240eabc83908bafa38bb8a9a3155ddaabf193763c877f9c41d1d79bfcf2fc

不过 tdengine 有一个专门的 arm 镜像,所以没这个问题,我只是举了个例子,实际你们直接用下面这个镜像就行了:Docker镜像地址
docker pull tdengine/tdengine-aarch64:3.0.1.8
docker pull tdengine/tdengine-aarch64:3.0.4.0
在一台 x86 电脑上 pull 完了,执行下面的命令就能导出 tar 包,执行命令的目录就是导出的 tar 包所在的目录。
docker save -o tdengine-aarch64-3.0.1.8.tar docker.io/tdengine/tdengine-aarch64:3.0.1.8
docker save -o tdengine-aarch64-3.0.4.0.tar docker.io/tdengine/tdengine-aarch64:3.0.4.0