Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nisaacson/docker-redis
Run a redis-server inside a docker container with ssh access
https://github.com/nisaacson/docker-redis
Last synced: about 1 month ago
JSON representation
Run a redis-server inside a docker container with ssh access
- Host: GitHub
- URL: https://github.com/nisaacson/docker-redis
- Owner: nisaacson
- Created: 2013-12-11T21:19:03.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-11T21:47:00.000Z (almost 11 years ago)
- Last Synced: 2024-04-14T14:46:35.034Z (7 months ago)
- Language: Shell
- Size: 113 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Docker Redis
===========Builds a docker image for redis. This is available as a [Trusted Build](http://blog.docker.io/2013/11/introducing-trusted-builds/) on the public docker index.
* Public Docker Index Link: [nisaacson/redis](https://index.docker.io/u/nisaacson/redis/)
# Usage
```bash
docker pull nisaacson/docker
ID=$(docker run -d -p 2222:22 -p 6379:6379 nisaacson/redis)
sleep "4s"
docker logs $ID
redis-cli -h localhost -p 6379
```# Building
To build a docker image, use the included `Vagrantfile` to launch up a virtual machine with docker already installed. The Vagrantfile uses the [vagrant docker provisioner](http://docs.vagrantup.com/v2/provisioning/docker.html) to install docker
**Requirements**
* [Vagrant](http://www.vagrantup.com/)
To launch the vagrant virtual machine
```bash
cd /path/to/this/repo
vagrant up
```Once the virtual machine is running you can test out the `Dockerfile` via
```bash
# log into the virtual machine
vagrant ssh
# go to the mounted shared folder
cd /vagrant# build a docker image from the Dockerfile
docker build -t redis .# ensure that the image exists, you should see the `redis` image in the list output
docker images# run the container, mapping ports on the host virtual machine to the same ports inside the container
ID=$(docker run -d -p 2222:22 -p 6379:6379 redis)# wait a few seconds and then check the logs on the container, you should see the output from redis starting up.
docker logs $ID
exit # quit the ssh session on the virtual machine
```To verify that the server is running, use the `redis-cli` tool to connect to the redis server running inside a container. Execute the following on the host virtual machine
```bash
# log into the virtual machine from your host computer
vagrant ssh
sudo apt-get install -y redis-server # will install an old version of redis such as 2.2.2
echo "INFO" | xargs redis-cli | grep "redis_version"
# should output "redis_version:2.8.2"
exit
```# Access Running container
If you need to check on the running redis server container, you can open a shell via ssh
```bash
ssh -p 2222 root@localhost
# password: redis
```