If you want to modify the configuration, there are several methods as follows:
1. Read the readme of the redis image provider and follow his method (usually by changing ENV) 2. Use the data volume method to mount the redis configuration file into it 3. Docker run starts an instance first , go in and modify it. After the modification is completed, docker commit to turn this container into a mirror.
The first thing I thought of when I saw this question was to go docker hub搜官方的redis镜像.然后看了redis的Dockerfile
. The official method is (corresponding to 1 above)
Additionally, If you want to use your own redis.conf ...
You can create your own Dockerfile that adds a redis.conf from the context into /data/, like so
FROM redis
COPY redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
or
$ docker run -v /myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf --name myredis redis redis-server /usr/local/etc/redis/redis.conf
This image will run by default when it starts. Just go in and overwrite the default startup command and add your own configuration. redis-server了。无法通过docker run -it redis修改。试图docker run -it redis /bin/bash
If you want to modify the configuration,
there are several methods as follows:
1. Read the readme of the redis image provider and follow his method (usually by changing ENV)
2. Use the data volume method to mount the redis configuration file into it
3. Docker run starts an instance first , go in and modify it. After the modification is completed, docker commit to turn this container into a mirror.
The first one is generally recommended.
I agree with the approach above.
The first thing I thought of when I saw this question was to go
docker hub
搜官方的redis镜像.然后看了redis的Dockerfile
.The official method is (corresponding to 1 above)
or
This image will run by default when it starts. Just go in and overwrite the default startup command and add your own configuration.
redis-server
了。无法通过docker run -it redis
修改。试图docker run -it redis /bin/bash