1:Linux下安装
1.1:直接通过yum安装docker
这是安装最新版本的docker,使用yum安装的软件不写版本默认安装最新版:
yum install -y docker
。
1.2:在安装完docker后检查
docker --version
。
1.3:初始化设置docker
编写daemon.json文件,vim /etc/docker/daemon.json,使用阿里云的docker加速
{
"registry-mirrors": [
"https://d8b3zdiw.mirror.aliyuncs.com"
],
"insecure-registries": [
"https://ower.site.com"
]
}
注意:其中的registry-mirrors设置的是阿里云的镜像加速地址,insecure-registries设置的是自己的私有仓库地址
1.4:重启docker
systemctl restart docker
。
1.5:运行镜像
以redis的时序数据库模块镜像为例来测试。
- 拉取镜像
[root@localhost RedisTimeSeries]# docker pull redislabs/redistimeseries
Using default tag: latest
Trying to pull repository docker.io/redislabs/redistimeseries ...
latest: Pulling from docker.io/redislabs/redistimeseries
6ec7b7d162b2: Pull complete
9361de297e14: Pull complete
34c400570387: Pull complete
ee77d1cabf52: Pull complete
2aa835955401: Pull complete
b48fe38ecf59: Pull complete
0d5e84ff21d8: Pull complete
ca20bc7d1515: Pull complete
2d85587a8972: Pull complete
50e2b1edfcc3: Pull complete
Digest: sha256:98e18d974673da04f009bb36e403ee797faed24560a291bf57b9e8a727e3151d
Status: Downloaded newer image for docker.io/redislabs/redistimeseries:latest
- 查看镜像
[root@localhost RedisTimeSeries]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/redislabs/redistimeseries latest 0b961fccd26d 16 months ago 143 MB
- 运行镜像启动容器
[root@localhost RedisTimeSeries]# docker run docker.io/redislabs/redistimeseries
1:C 08 Nov 2022 08:35:39.196 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 08 Nov 2022 08:35:39.196 # Redis version=6.0.9, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 08 Nov 2022 08:35:39.196 # Configuration loaded
1:M 08 Nov 2022 08:35:39.197 * Running mode=standalone, port=6379.
1:M 08 Nov 2022 08:35:39.197 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 08 Nov 2022 08:35:39.197 # Server initialized
1:M 08 Nov 2022 08:35:39.197 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 08 Nov 2022 08:35:39.198 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo madvise > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled (set to 'madvise' or 'never').
1:M 08 Nov 2022 08:35:39.198 * <timeseries> RedisTimeSeries version 10410, git_sha=d7ccf2a41cb2fdc92d00f3cc930477467e661916
1:M 08 Nov 2022 08:35:39.198 * <timeseries> Redis version found by RedisTimeSeries : 6.0.9 - oss
1:M 08 Nov 2022 08:35:39.198 * Module 'timeseries' loaded from /usr/lib/redis/modules/redistimeseries.so
1:M 08 Nov 2022 08:35:39.198 * Ready to accept connections
- 从容器内拷贝文件到本地
[root@localhost ~]# docker cp heuristic_cori:/usr/lib/redis/modules/redistimeseries.so /root/study
[root@localhost ~]# cd /root/study/
[root@localhost study]# ll
total 152
...
-rwxr-xr-x. 1 root root 147576 Jul 5 2021 redistimeseries.so
2:win下安装
走你 。
正常按照上面这位大哥写的文章就没问题了。另外如果是遇到docker启动不成功的情况,就把小鲸鱼多重启几次,一般会提示你是哪里出现了问题。
最后如下就是成功了:
写在后面
参考文章列表: