diff --git a/docs/sources/examples/index.rst b/docs/sources/examples/index.rst index 0ab2143a30..e01f662002 100644 --- a/docs/sources/examples/index.rst +++ b/docs/sources/examples/index.rst @@ -15,4 +15,5 @@ Contents: hello_world hello_world_daemon python_web_app + running_redis_service running_ssh_service diff --git a/docs/sources/examples/running_redis_service.rst b/docs/sources/examples/running_redis_service.rst new file mode 100644 index 0000000000..a0fc0dd916 --- /dev/null +++ b/docs/sources/examples/running_redis_service.rst @@ -0,0 +1,62 @@ +:title: Running a Redis service +:description: Installing and running an redis service +:keywords: docker, example, package installation, networking, redis + +.. _running_redis_service: + +Create a redis service +====================== + +Very simple, no frills, redis service. + +This example assumes you have Docker installed and the base image already +imported. + +Open a docker container +----------------------- + +:: + + $ docker run -i -t base /bin/bash + +Building your image +------------------- + +Within your docker container. Once installed, out of docker. + +:: + + $ apt-get update + $ apt-get install redis-server + SIGINT received + +Snapshot the installation +------------------------- + +:: + + $ docker ps # grab the container id + $ docker commit /redis + +Run the service +--------------- + +Running the service with `-d` runs the container in detached mode, leaving the +container running in the background. +:: + + $ docker run -d -p 6379 -i -t /redis /usr/bin/redis-server + +Test +---- + +:: + + $ docker ps # grab the new container id + $ docker inspect # grab the ipaddress + $ docker port 6379 # grab the external port + $ redis-cli -h -p + redis 10.0.3.32:49175> set docker awesome + OK + redis 10.0.3.32:49175> get docker + "awesome"