Dockerizing a Redis service (Engine)
Dockerizing a Redis service
Very simple, no frills, Redis service attached to a web application using a link.
Create a Docker container for Redis
Firstly, we create a Dockerfile
for our new Redis image.
FROM ubuntu:14.04 RUN apt-get update && apt-get install -y redis-server EXPOSE 6379 ENTRYPOINT ["/usr/bin/redis-server"]
Next we build an image from our Dockerfile
. Replace <your username>
with your own user name.
$ docker build -t <your username>/redis .
Run the service
Use the image we’ve just created and name your container redis
.
Running the service with -d
runs the container in detached mode, leaving the container running in the background.
Importantly, we’re not exposing any ports on our containe