docker 安装与启动
docker run -itd --name redis-huanwei -p 63790:6379
进入redis容器
docker exec -it redis-huanwei /bin/bash
或
docker exec -it redis-test bash
报错如下:
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:235: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory"
或
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:235: starting container process caused "exec: \"bash\": executable file not found in $PATH"
解决办法:
docker run --name redis-huanwei -p 63790:6379 \
-v /usr/local/app/redis-huanwei/redis.conf:/etc/redis/redis.conf \
-v /usr/local/app/redis-huanwei/data:/data \
-d --restart=always redis:5.0 redis-server /etc/redis/redis.conf \
--appendonly yes \
再次用上面的命令进入容器,就成功了