- Introduction
- Contributing
- Reporting Issues
- Installation
- Quick Start
- Configuration
- Shell Access
- Upgrading
Dockerfile to build a redis container image which can be linked to other containers.
If you find this image useful here's how you can help:
- Send a Pull Request with your awesome new features and bug fixes
- Help new users with Issues they may encounter
- Send me a tip via Bitcoin or using Gratipay
Docker is a relatively new project and is active being developed and tested by a thriving community of developers and testers and every release of docker features many enhancements and bugfixes.
Given the nature of the development and release cycle it is very important that you have the latest version of docker installed because any issue that you encounter might have already been fixed with a newer docker release.
For ubuntu users I suggest installing docker using docker's own package repository since the version of docker packaged in the ubuntu repositories are a little dated.
Here is the shortform of the installation of an updated version of docker on ubuntu.
sudo apt-get purge docker.io
curl -s https://get.docker.io/ubuntu/ | sudo sh
sudo apt-get update
sudo apt-get install lxc-dockerFedora and RHEL/CentOS users should try disabling selinux with setenforce 0 and check if resolves the issue. If it does than there is not much that I can help you with. You can either stick with selinux disabled (not recommended by redhat) or switch to using ubuntu.
If using the latest docker version and/or disabling selinux does not fix the issue then please file a issue request on the issues page.
In your issue report please make sure you provide the following information:
- The host ditribution and release version.
- Output of the
docker versioncommand - Output of the
docker infocommand - The
docker runcommand you used to run the image (mask out the sensitive bits).
Pull the latest version of the image from the docker index. This is the recommended method of installation as it is easier to update image in the future. These builds are performed by the Docker Trusted Build service.
docker pull sameersbn/redis:latest
Alternately you can build the image yourself.
git clone https://github.com/sameersbn/docker-redis.git
cd docker-redis
docker build -t="$USER/redis" .
Run the redis image
docker run -name redis -d sameersbn/redis:latest
To test if the redis server is configured properly, try connecting to the server.
redis-cli -h $(docker inspect --format {{.NetworkSettings.IPAddress}} redis)
You should mount a volume at /var/lib/redis.
mkdir -p /opt/redis
docker run -name redis -d \
-v /opt/redis:/var/lib/redis sameersbn/redis:latest
This will make sure that the data stored in the database is not lost when the image is stopped and started again.
For debugging and maintenance purposes you may want access the containers shell. If you are using docker version 1.3.0 or higher you can access a running containers shell using docker exec command.
docker exec -it redis bashIf you are using an older version of docker, you can use the nsenter linux tool (part of the util-linux package) to access the container shell.
Some linux distros (e.g. ubuntu) use older versions of the util-linux which do not include the nsenter tool. To get around this @jpetazzo has created a nice docker image that allows you to install the nsenter utility and a helper script named docker-enter on these distros.
To install nsenter execute the following command on your host,
docker run --rm -v /usr/local/bin:/target jpetazzo/nsenterNow you can access the container shell using the command
sudo docker-enter redisFor more information refer https://github.com/jpetazzo/nsenter
To upgrade to newer releases, simply follow this 3 step upgrade procedure.
- Step 1: Stop the currently running image
docker stop redis
- Step 2: Update the docker image.
docker pull sameersbn/redis:latest
- Step 3: Start the image
docker run -name redis -d [OPTIONS] sameersbn/redis:latest