Linux和win下安装docker

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启动不成功的情况,就把小鲸鱼多重启几次,一般会提示你是哪里出现了问题。

最后如下就是成功了:
在这里插入图片描述

写在后面

参考文章列表:

Docker run 运行镜像

怎么把docker里面的文件拷贝出来

Redis干货|解锁Redis 时间序列数据的应用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值