Skip to Content
Using Docker
book

Using Docker

by Adrian Mouat
December 2015
Beginner to intermediate
354 pages
8h 38m
English
O'Reilly Media, Inc.
Content preview from Using Docker

Chapter 3. First Steps

This chapter will guide you through your first steps with using Docker. We start by launching and using some simple containers to give you a feel for how Docker works. Then we move onto Dockerfiles—the basic building block of Docker containers—and Docker Registries, which support the distribution of containers. The chapter concludes with a look at how to use a container to host a key-value store with persistent storage.

Running Your First Image

To test that Docker is installed correctly, try running:

$ docker run debian echo "Hello World"

This may take a little while, depending on your Internet connection, but eventually you will get something similar to the following:

Unable to find image 'debian' locally
debian:latest: The image you are pulling has been verified
511136ea3c5a: Pull complete
638fd9704285: Pull complete
61f7f4f722fb: Pull complete
Status: Downloaded newer image for debian:latest
Hello World

So what’s happened here? We’ve called the docker run command, which is responsible for launching containers. The argument debian is the name of the image1 we want to use—in this case, a stripped-down version of the Debian Linux distribution. The first line of the output tells us we don’t have a local copy of the Debian image. Docker then checks online at the Docker Hub and downloads the newest version of the Debian image. Once the image has been downloaded, Docker turns the image into a running container and executes the command we specified—echo "Hello ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Docker Orchestration

Docker Orchestration

Randall Smith
Docker Cookbook

Docker Cookbook

Sébastien Goasguen
Docker Security

Docker Security

Adrian Mouat
Docker Cookbook - Second Edition

Docker Cookbook - Second Edition

Ken Cochrane, Jeeva S. Chelladhurai, Neependra K Khare

Publisher Resources

ISBN: 9781491915752Errata Page