Difficulty: Beginner
Estimated Time: 10 minutes

In this first scenario, you'll take the role of Jane, a developer who needs to deploy a new Key-Value Store for an application she's working with. After discussions, it's been decided to use Redis, a popular KV Store.

Jane is unfamiliar with how Redis is deployed but has heard Docker makes it straightforward to deploy services into development and production.

This scenario discusses how she will complete her task and deploy Redis as a Docker Container.

Jane's development environment has access to latest version of the Docker Engine via a machine called docker. Her local dev machine has the Docker Client installed and accessible via the command line.

What Is Docker?

Docker describes themselves as "an open platform for developers and sysadmins to build, ship, and run distributed applications".

Docker allows you to run containers. A container is a sandboxed process running an application and its dependencies on the host operating system. The application inside the container considers itself to be the only process running on the machine while the machine can run multiple containers independently.

In this scenario, Jane had the requirement of running Redis. Jane decided to run this as a Docker Container to make it easier to manage. The commands Jane discovered are the cornerstone of running Docker in both development and production environments.

In the next scenario, Jane will look into how it's possible to build her own Docker Image.

Deploying Your First Docker Container

Step 1 of 6

Step 1 - Running A Container

The first task is to identify the name of the Docker Image which is configured to run Redis. With Docker, all containers are started based on a Docker Image. These images contain everything required to launch the process; the host doesn't require any configuration or dependencies.

Jane can find existing images at registry.hub.docker.com/ or by using the command docker search <name>. For example, to find an image for Redis, you would use docker search redis.


Using the search command, Jane has identified that the Redis Docker Image is called redis and wants to run the latest release. Because Redis is a database, Jane wants to run it as a background service while she continues to work.

To complete this step, launch a container in the background running an instance of Redis based on the official image.

The Docker CLI has a command called run which will start a container based on a Docker Image. The structure is docker run <options> <image-name>.

By default, Docker will run a command in the foreground. To run in the background, the option -d needs to be specified.

docker run -d redis

By default, Docker will run the latest version available. If a particular version was required, it could be specified as a tag, for example, version 3.2 would be docker run -d redis:3.2.

As this is the first time Jane is using the Redis image, it will be downloaded onto the Docker Host machine.