This lesson is still being designed and assembled (Pre-Alpha version)

Running Docker Containers

Overview

Teaching: 25 min
Exercises: 15 min
Questions
  • Where do Docker images come from?

  • How do I run a Docker container based on a Docker image?

  • How do I access a running Docker container?

  • How do I make my research project files accessible inside a Docker container?

  • How do a delete a Docker container when I no longer need it?

Objectives
  • Pull a Docker image from DockerHub.

  • Run a Docker container based on a Docker image.

  • Access an interactive shell inside a running Docker container.

  • Mount a directory on your local machine into a Docker container.

  • Delete a Docker container when it is no longer needed.

Docker Client is the primary way you’ll interact with Docker. When you use the Docker Command Line Interface (CLI) you type a command into your terminal that starts with docker. Docker Client then uses the Docker API to send the command to the Docker Daemon.

Key Points

  • Existing Docker images can be pulled from container registries such as DockerHub.

  • To run a Docker container based on a Docker image use the docker container run command.

  • ???

  • Mount a directory on the host into a container by passing the --volume option to the docker container run command.

  • Pass the --rm flag when using the docker container run command to automatically remove the container when it exits.